newb to C, cant figure something out.
i JUST started C a few days ago.
i decided, after reading a prog in a book i have, to make a program to either multiply or divide two ints depending on user input.
so i wrote the program, got like 14 compile errors, fixed most of em
now im down to 2-4 compile errors, and i just cant figure them out.
either they r too cryptic, or i just don understand yet.
here are the errors, if you need program source i will post:
c:\docume~1\galgar~1\desktop\untitl~1.cpp: In function `int main()':
c:\docume~1\galgar~1\desktop\untitl~1.cpp:17: parse error before `else'
c:\docume~1\galgar~1\desktop\untitl~1.cpp: At top level:
c:\docume~1\galgar~1\desktop\untitl~1.cpp:22: parse error before `return'
actually, here is source:
please tell me what im doing wrong... i cant figure it out.
int num1, num2, num3, num4;
int product(int x, int y);
int divide(int z, int a);
int main( void )
printf ("pick Multiply, divide(1,2):");
scanf ("%d", &num4);
printf ("enter a number:");
scanf ("%d", &num1);
printf ("Enter another number:");
scanf ("%d", &num2);
if (num4 == 1)
printf ("total multiplied is: %d",num3);
printf ("total divided is: %d",num3);
int product(int x,int y)
int divide(int z, int a)
Thanks in Advance,
try this for program termination
this was my solution to program termination: i wrote a fucntion using the <time.h> header that waits for the specified number of seconds before it terminates, so that output can be seen before termination. If you need the code, I can get it to you.