Compliler errors

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2006
Posts: 6
Reputation: SammyHasibi is an unknown quantity at this point 
Solved Threads: 0
SammyHasibi SammyHasibi is offline Offline
Newbie Poster

Compliler errors

 
0
  #1
Sep 5th, 2007
[6 #include <stdio.h>
7 int main ()
8 /* Declare and initialize variables. */
9 int number1 = 4, number2 = 7, sum;
10 /* Calculate sum. */
11 sum = numberl + number2;
12 /* Print the sum. */
13 printf("The sum is */.d \n", sum);
14 /* Exit program. */
15 system ("pause");
16 return 0;]

We HAVE to work within Bloodshed 4.9.9.2.

Please help me.

Errors per compiler:
In function 'main'
line 9 parameter 'number1' is initilaized
line 9 parameter 'number2' is initialized
line 11 syntax error b4 sum
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,311
Reputation: vishesh is on a distinguished road 
Solved Threads: 36
vishesh's Avatar
vishesh vishesh is offline Offline
Nearly a Posting Virtuoso

Re: Compliler errors

 
1
  #2
Sep 5th, 2007
Well loads of problems. Lets discuss each pf the:

1. Learn to indent your code and do not insert linenumbers before each line. We dont need that, [ code ] tags does it for you. See this.

2. Now the problems with code. First one is that you havn't inserted '{' at beginning and '}' at end of main() function.

3. In sum = numberl + number2;line you have typed numberl instead of number1.

4. You have use printf() function improperly. It must be
printf("The sum is %d \n", sum);. Read This.

5. Dont use system("pause"). Although it has nothing to do with errors but try using getchar() instead. Read This.
Last edited by vishesh; Sep 5th, 2007 at 3:41 am.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Compliler errors

 
0
  #3
Sep 5th, 2007
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC