Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,605 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 930 people online right now. Registration is fast and FREE... Join Now!




expression syntax error in function main

 
Reply to this topicStart new topic

expression syntax error in function main

devikopparthi
post 16 Jul, 2008 - 05:33 AM
Post #1


New D.I.C Head

*
Joined: 16 Jul, 2008
Posts: 1

CODE

# include<stdio.h>
int first;
int second;
void main() {

printf("\n enter the first:">;
scanf("%d",&first);
printf("\n enter the second:");
scanf("%d",& second);
printf("the two numbers are:%d%d\n",first,second);
scanf("this sum is %d\n", first+second);
}
User is offlineProfile CardPM

Go to the top of the page

Cerolobo
post 16 Jul, 2008 - 05:35 AM
Post #2


D.I.C Regular

Group Icon
Joined: 5 Apr, 2008
Posts: 440



Thanked 31 times
My Contributions


CODE
printf("\n enter the first:">;


should be this
CODE
printf("\n enter the first:");



Also, you really should use int main() instead of void main(), and add a return 0; at the bottom of main().
User is offlineProfile CardPM

Go to the top of the page

AmitTheInfinity
post 16 Jul, 2008 - 05:36 AM
Post #3


C Surfing ∞

Group Icon
Joined: 25 Jan, 2007
Posts: 1,015



Thanked 34 times

Dream Kudos: 125
My Contributions


Your first printf ends with a triangular bracket!!!

cpp

printf("\n enter the first:">; // ends with Triangular bracket!!!

printf("\n enter the first:"); //should be like this, right?


I hope this will help you. smile.gif


--EDIT--

I need to practice harder to be faster than Cerolobo smile.gif

--EDIT--

This post has been edited by AmitTheInfinity: 16 Jul, 2008 - 05:38 AM
User is offlineProfile CardPM

Go to the top of the page

Cerolobo
post 16 Jul, 2008 - 05:44 AM
Post #4


D.I.C Regular

Group Icon
Joined: 5 Apr, 2008
Posts: 440



Thanked 31 times
My Contributions


QUOTE(AmitTheInfinity @ 16 Jul, 2008 - 06:36 AM) *
I need to practice harder to be faster than Cerolobo smile.gif


That, or just hammer your refresh button...
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/23/08 02:18AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month