Advertisement
Guest User

laba2

a guest
Sep 27th, 2016
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.98 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4. #include <ctype.h>
  5. void menu() {
  6.     char R1 = ' ';
  7.     char R2 = ' ';
  8.     //int Xstart = 0; скорее всего здесь другой тип
  9.     //int Xend = 0;
  10.     //int deltaX = 0;
  11.     int flag = 0;
  12.     char radius = ' ';
  13.     char k = ' ';
  14.     printf("Laba №2,  nomer variant\n");
  15.     printf(" name/surname");
  16.     while (1 == 1) {
  17.        
  18.         if (flag == 0) {
  19.             printf("Input R1:\n");
  20.             scanf_s("%c", &R1);
  21.             fflush(stdin);
  22.             if ((!isdigit(R1)) || (R1 <= 0)) {
  23.                 printf("Wrong input parameter, {Radius should be greater than zero and should be a digit}. Type ‘y’ for repeat, or any other for exit from application\n");
  24.                 system("pause");
  25.                 scanf_s("%c", &k);
  26.                 fflush(stdin);
  27.                 if (k == 'y') {
  28.                     flag = 1;
  29.                     continue;
  30.                 }
  31.                 else {
  32.                     flag = 0;
  33.                     continue;
  34.                 }
  35.             }
  36.             else{
  37.                 flag = 0;
  38.                 radius = atoi(&R1);
  39.                
  40.             }
  41.            
  42.  
  43.            
  44.     }
  45.  
  46.     }
  47.  
  48. }
  49. int main(void) {
  50.  
  51.     menu();
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement