By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,816 Members | 2,151 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,816 IT Pros & Developers. It's quick & easy.

i get a fatal error c1075 and can't find where i need to add another curved bracket

P: n/a
Expand|Select|Wrap|Line Numbers
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <conio.h>
  4. void main ()
  5. {
  6.     int month,year;
  7.     int days,weeks,left;
  8.     char x;
  9.     float a,b,c;
  10.     do
  11.     {
  12.     puts("Please enter:\nL to solve a linear equation\nD to calc the num of days in month\nW to calc the num of weeks and days");
  13.     fflush(stdin);
  14.     scanf("%c",&x);
  15.         while (x!= 'L' && x!='D' &&x!='W')                
  16.     {
  17.         printf("Please type (L or D or W)\n");
  18.         fflush(stdin);
  19.         scanf("%c",&x);
  20.     }
  21.     switch(x) 
  22.     {
  23.         case 'L':                                    
  24.         puts("Please insert equation ax+b=0 argument (float): a ant than b");
  25.         fflush(stdin);
  26.         scanf("%f%f",&a,&b);
  27.         if (a==0 && b==0)
  28.             printf("there is infinity sulotions for the linear equation: %fx+%f=0 ",a,b);
  29.         else if (a==0)
  30.             printf("there is no sulotion for the linear equation: %fx+%f=0 ",a,b);
  31.         else
  32.         {
  33.             b=b*-1;
  34.             c=b/a;
  35.             printf("\nThe single sulotion for the linear equation is: %f\n",c);
  36.         }
  37.         break;
  38.         case 'D':                                            
  39.         puts("Please enter the month (1 - 12) and the year");
  40.         fflush(stdin);    
  41.         scanf("%d%d",&month,&year);
  42.         while (month > 12 || month < 1)                        
  43.         {
  44.             puts("No man! Please enter the month (1 - 12) and the year");
  45.             fflush(stdin);    
  46.             scanf("%d%d",&month,&year);
  47.         }
  48.         if (month==2)
  49.         {    
  50.             if (year%4==0,year%400==0)
  51.                 printf("The num of days is 28\n");
  52.             else
  53.                 puts("The num of days is 29");
  54.         }
  55.         else if(month<=7)
  56.         {
  57.             if (month%2==1)
  58.             puts("The num of days is 31");
  59.             else
  60.             puts("The num of days is 30");
  61.         }
  62.         else
  63.         {
  64.             if (month%2==0)
  65.             puts("The num of days is 31");
  66.             else
  67.             puts("The num of days is 30");
  68.         }
  69.         break;
  70.         default:                                            
  71.         puts("Please enter a num of days");
  72.         fflush(stdin);
  73.         scanf("%d",&days);
  74.         while (days<0)
  75.             {
  76.                 puts("Please try again to enter a positive num of days");
  77.                 fflush(stdin);
  78.                 scanf("%d",&days);
  79.             }
  80.         weeks=days/7;
  81.         left=days%7;
  82.         printf("The num of weeks is: %d and the num of days is: %d\n" , weeks ,left);
  83.         break;
  84.     }
  85.     puts("\n\npress any key to finish . . .");
  86.     _getch();
  87.     printf("\n===========================================================\n\n");
  88.     puts("\n\nGood bye and thank you, hope you enjoyed with my prog, dog.\n\n");
  89.     }
  90.  
Nov 10 '10 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 2,398
In the future, please provide the full text of the compiler error message. That would make it a lot easier to help you.

I don't know if these issues are related to this error, but ...
  1. Lines 26 and 35: the variable types are not consistent with the format string.
  2. Lines 26, 41, 46: you may need a separator between the two numbers.
  3. Line 50: the if-condition is illegal.
  4. Lines 13, 18, 25, 40, 45, 72, 77: I'm not sure, but I think flushing stdin yields undefined behavior.
Nov 11 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.