Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 19th, 2004, 4:36 AM   #1
Unconscious
Newbie
 
Join Date: Sep 2004
Posts: 15
Rep Power: 0 Unconscious is on a distinguished road
I just tryed to compile this code:
#include <iostream>

int main ()
{
int age
cout<<"Asl?";
cin>>age;
if (age<50)
{
cout<<"wow, your young";
}
else if (age==100)
{
cout<<"jesus, old guy";
}
else
{
cout<<"foocking hell, dont break a hip grandpa";
}
return 0;
}

With dev-C++, it is coming up with a lot of errors, what is wrong with it?
Thanks.
Unconscious is offline   Reply With Quote
Old Sep 19th, 2004, 6:33 AM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
cout is in iostream.h. When using iostream, you must tell the compiler you're using the Standard Template Library, either by using std::cout instead of cout, or by typing using namespace std; after your #include directives.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Sep 19th, 2004, 7:09 AM   #3
Unconscious
Newbie
 
Join Date: Sep 2004
Posts: 15
Rep Power: 0 Unconscious is on a distinguished road
Hmm, that didn't solve anything.

#include <iostream>
using namespace std;

int main ()
{
int age
cout<<"Asl?";
cin>>age;
if (age<50)
{
cout<<"wow, your young, Sorta";
}
else if (age==100)
{
cout<<"jesus, old guy";
}
else
{
cout<<"foocking hell, dont break a hip grandpa";
}
return 0;
}
Unconscious is offline   Reply With Quote
Old Sep 19th, 2004, 7:14 AM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
It should be:

int age;

Note the semicolon.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Sep 19th, 2004, 7:24 AM   #5
Unconscious
Newbie
 
Join Date: Sep 2004
Posts: 15
Rep Power: 0 Unconscious is on a distinguished road
Ooble helped me fix it, Thanks.
Unconscious is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:59 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC