Board index » cppbuilder » Newbie help again

Newbie help again


2004-07-31 12:04:16 AM
cppbuilder95
I know I'm new, don't laugh at me... I seem to be getting an error on
lines 9 and 10 of this simple program I'm trying to write.
#include<stdio.h>
int main ()
{
int a, b, c
printf ( "Input 3 numbers" );
scanf ( "%d%d%d", &a, &b, &c )
a = a + b + c
printf ( "Sum is %d", a);
return 0;
}
Can anybody help me with what is wrong?
 
 

Re:Newbie help again

All statements in C/C++ need a smicolon to terminate them.
Regards,
Bruce
 

Re:Newbie help again

I tried that, but I got even another error. These are the errors I'm
getting:
Error E2141 integertest.c 9: Declaration syntax error in function main
Error E2379 integertest.c 12: Statement missing ; in function main
Warning W8004 integertest.c 15: 'd' is assigned a value that is never
used in function main
Here is my int main:
int a, b, c, d
printf("Input 3 numbers");
scanf("%d%d%d", &a, &b, &c);
d = a + b + c
printf( "Sum is %d", d);
return 0;
 

{smallsort}

Re:Newbie help again

Quote
I tried that, but I got even another error. These are the errors I'm
getting:

Error E2141 integertest.c 9: Declaration syntax error in function main
Error E2379 integertest.c 12: Statement missing ; in function main
Warning W8004 integertest.c 15: 'd' is assigned a value that is never
used in function main

Here is my int main:

int a, b, c, d <<<< Need semicolon here!

printf("Input 3 numbers");
scanf("%d%d%d", &a, &b, &c);
d = a + b + c <<<< And here!
printf( "Sum is %d", d);

return 0;
Regards,
Bruce
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/04
 

Re:Newbie help again

Nick -- you are still missing a couple of semicolons.
Nick Knopf < XXXX@XXXXX.COM >wrote:
Quote
I tried that, but I got even another error. These are the errors I'm
getting:

Error E2141 integertest.c 9: Declaration syntax error in function main
Error E2379 integertest.c 12: Statement missing ; in function main
Warning W8004 integertest.c 15: 'd' is assigned a value that is never
used in function main

Here is my int main:

int a, b, c, d

printf("Input 3 numbers");
scanf("%d%d%d", &a, &b, &c);
d = a + b + c
printf( "Sum is %d", d);

return 0;
 

Re:Newbie help again

Thanks a bunch, guys!