473,494 Members | 2,223 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Syntax error in code

3 New Member
keep getting error
syntax error before


Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <conio.h>
  4.  
  5. void PrintMenu(char);
  6. int EnterNumber(int ,int );
  7. int FindMaximum(int ,int );
  8. int FindMinimum(int ,int );
  9. int IsEqual(int ,int );
  10.  
  11.  
  12.  
  13. int main(int argc, char *argv[])
  14. {
  15.  
  16.   char choice;
  17.   int number1, number2;
  18.   while(1){
  19.   printf("=========================================================\n");
  20.   printf("* A (a):Enter two integer numbers                       *\n");
  21.   printf("* B (b):Find the maximum of the two numbers             *\n");
  22.   printf("* C (c):Find the minimum of the two numbers             *\n");
  23.   printf("* D (d):Determine if both numbers are equal             *\n");
  24.   printf("* Q (q):Quit program                                    *\n");
  25.   printf("=========================================================\n");
  26.   printf("\n");
  27.  
  28.   printf("*Enter Your Chice:  ");
  29.   scanf("%c",&choice); 
  30. }
  31.  
  32.   void PrintMenu(char choice)
  33.           {            
  34.           printf("\nPlease Enter an Integer:");
  35.           scanf("%d",&number1);
  36.           printf("\n");
  37.           printf("\nPlease Enter an Integer:");
  38.           scanf("%d",&number2);
  39.           printf("\n You entered %d and %d\n",number1,number2);
  40.           }
  41.  
  42.   int EnterNumber(char choice)
  43.       {
  44.        if (number2<number1)
  45.        printf("The Bigger number is %d\n",number1);
  46.        else if (number1<number2)    
  47.        printf("The Bigger number is %d\n",number2);
  48.        }
  49.  
  50.   int FindMaximum(int number1, int number2)
  51.       {
  52.       if (number1<number2)
  53.       printf("The Smaller number is %d\n",number1);
  54.       else if (number2<number1)
  55.       printf("The Smaller number is %d\n",number2);
  56.       }
  57.  
  58.  
  59.   int FindMinimum(int number1, int number2)
  60.       {
  61.      if(number1 == number2)
  62.      printf("The numbers are equal\n");
  63.      else if(1)
  64.      printf("The numbers are NOT Equal\n");
  65.      }
  66.  
  67.  
  68.   int IsEqual(int number1, int number2)
  69.   {
  70.   if(number1 == 'q'&& number2 == 'q')
  71.   printf("\n Quitting program!");
  72.   }
  73.  
  74. switch(choice)
  75. {
  76. case 'a':
  77. case 'A': PrintMenu(char choice)
  78. break;
  79.  
  80. case 'b':
  81. case 'B':
  82. EnterNumber(char choice)
  83. break; 
  84.  
  85. case 'c':
  86. case 'C':
  87. FindMaximum(int number1,int number2)
  88. break;
  89.  
  90. case 'd':
  91. case 'D':
  92. FindMinimum(int number1,int number2)
  93. break;
  94.  
  95. case 'q':
  96. case 'Q':
  97. IsEqual(int number1,int number2)
  98. break;
  99. }
  100.  
  101.  
  102.  
  103.  
  104.  
Apr 15 '12 #1
1 1687
weaknessforcats
9,208 Recognized Expert Moderator Expert
You are missing some semi-colons in your switch statement. Also this switch appears to be floating outside any function. That won't work:
Expand|Select|Wrap|Line Numbers
  1. switch(choice)
  2.  75. {
  3.  76. case 'a':
  4.  77. case 'A': PrintMenu(char choice) <-----!
  5.  78. break;
  6.  
Then your prototype:
Expand|Select|Wrap|Line Numbers
  1. int EnterNumber(int ,int );
doesn't match the code for the function which has a single char argument rather than 2 ints.

There may be other errors. What you try to do is fix only the first error and then rebuild your program. The first error may cause the compiler to find other things wrong that maybe aren't wrong. Eventually by fiing the first error you will get a clean build. Then you can start the actual debugging.
Apr 15 '12 #2

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

Similar topics

2
1913
by: m3ckon | last post by:
Hi there, had to rush some sql and am now going back to it due to a slow db performance. I have a db for sales leads and have created 3 views based on the data I need to produce. However one...
6
1758
by: James Walker | last post by:
Can some one help I get an error of 'checkIndate' is null or not an object can someone please help. I can't work out why Thanks in advance James <form> <td height="24" colspan="7"...
0
1675
by: Kurt Watson | last post by:
I’m having a different kind of problem with Hotmail when I sign in it says, "Web Browser Software Limitations Your Current Software Will Limit Your Ability to Use Hotmail You are using a web...
7
2360
by: Alan Bashy | last post by:
Please, guys, In need help with this. It is due in the next week. Please, help me to implement the functions in this programm especially the first three constructor. I need them guys. Please, help...
1
1369
by: Steve | last post by:
Hi, I've asked this question a couple of times before on this forum but no one seems to be nice enough to point me to the right direction or help me out with any information, if possible. Please...
22
2142
by: KitKat | last post by:
I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6, Cam 7, and Cam 8. Well it does that but it also needs to change the file name to the same folder where the file is being...
17
2264
by: Saps | last post by:
Hi all. Can anyone help me here. I have loads of .sql files and i need a way to call these from my asp page so the user can run them from the browser. Meaning i have a page with a list of all...
8
3138
by: CM | last post by:
Hi, Could anyone please help me? I am completing my Master's Degree and need to reproduce a Webpage in Word. Aspects of the page are lost and some of the text goes. I would really appreciate it....
1
1519
SKJoy2001
by: SKJoy2001 | last post by:
PLEASE HELP ME!!! P E R L!!! I have a CGI (PERL) file namely 'test.cgi' and it has the correct permission (755) on the FTP server and it is within the CGI path. I have the following code in it:...
6
3280
by: jenipriya | last post by:
Hi all... its very urgent.. please........i m a beginner in oracle.... Anyone please help me wit dese codes i hv tried... and correct the errors... The table structures i hav Employee (EmpID,...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6873
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5453
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4889
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
644
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.