Heading Here

Im Getting declaration syntax error in void func2 (intc, intd), need help fixing it,
and im new to this so i have no idea whats going on..

include <stdio.h>

include <conio.h>

void func1 (int a, int b)
void func2 (int c, int d)
void main (void)

  {int a,b;
int c,d;
char ch;
printf (" Enter two numbers ");
scanf (" %d %d"; &a, &b);
printf ("Enter two numbers");
scanf (" %d %d"; &c, &d);
printf ("\n press 1 to call function 1 \n 2. to call function 2");
ch = getche();
switch (ch)
{
case '+':
func1 (a,b);
break;
case '-';
func2 (c,d);
break;
default;
printf ("\n Wrong choices");
}
}
void func1 (int a, int b)
{
printf ("\n Sum=%d", a+b);
}
void func2 (int c, int d)
{
printf ("\n Difference=%d", c-d);
}

Edited 1 Year Ago by Rimi_1

You're missing ; after you declare functions at the top, you're using a ; instead of a , in line 5 and 6, you're using ; instead of : in some case statements.

Heading Here

Well Thank You so much, I Fixed the errors in my last post, i can run it, but the program isn't working properly , the screen reads "Enter two numbers" so i do that for both functions but then the screen reads "Press 1 to call function 1 and 2 to call function 2" after i press 1 or 2 i do not get the answer , please help me

Your case statements are looking for + or -, so why do you ask the user to enter 1 or 2? 1 is not the same as +. 2 is not the same as -

This article has been dead for over six months. Start a new discussion instead.