Newbie help again

Newbie help again

Post by Nick Knop » Sun, 01 Aug 2004 01:04:16


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?
 
 
 

Newbie help again

Post by Bruce Salz » Sun, 01 Aug 2004 01:11:57

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

Regards,
Bruce

 
 
 

Newbie help again

Post by Nick Knop » Sun, 01 Aug 2004 02:08:32

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;
 
 
 

Newbie help again

Post by Bruce Salz » Sun, 01 Aug 2004 02:20:34

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

Regards,
Bruce


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.yqcomputer.com/ ).
Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/04
 
 
 

Newbie help again

Post by Richard Ha » Sun, 01 Aug 2004 02:21:47


Nick -- you are still missing a couple of semicolons.
 
 
 

Newbie help again

Post by Nick Knop » Sun, 01 Aug 2004 03:05:03

Thanks a bunch, guys!