Jump to content
  • Advertisement
Sign in to follow this  
leonheart

hey new bies check this out

This topic is 4753 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im a newbie to i have just come up with a really funny program if u enter ur age below 17 it says ur at a cool age ( cos im 15) if u enter ur age above 20 its says your ancient (carries on) if u enter in between 17 and 20 it will say not to old i suppose enter this nect code and compile tell me what u think experts tell me what i can do to improve or change it slightly to be funnier please thanx

Share this post


Link to post
Share on other sites
Advertisement
crap i forgot the code
here u go

#include <iostream.h>

using namespace std;

int main()
{
int age;

cout<<"please input your age: ";
cin>> age;
cin.ignore();
if ( age < 17 ) {
cout<<"you are at a cool age\n";
}
else if ( age > 20 ) {
cout<<"whoah your ancient how good a mate was jesus at school\n";
cout<<"only joking\n";
}
else {
cout<<"not to old i suppose\n";
}
cin.get();
}




me stupid i forget the most important bit derrr

Share this post


Link to post
Share on other sites
Well, somebody's going to point it out sooner or later:

Use
#include <iostream>
not
#include <iostream.h>


The STL headers without ".h" are the newer standard.

Share this post


Link to post
Share on other sites
While people are pointing things out, I might as well let you know that it's 'too', not 'to' in the sentence "Not too old, I suppose." ;)

Share this post


Link to post
Share on other sites
CanI safely assume that if I enter 15, your program will say "doodz, u rulz0rz teh l4zy l337-like sms 2p34k wihc is unradabel by teh ancient".

This is a forum, you have some time to type your text before anyone will answer, and believe it or not, but you are (not 'your', remember this) allowed to use this time to write more correct English sentences.

Anyway, you should replace those "\n" with std::endl, just like in this statement:


std::cout << "whoah your ancient how good a mate was jesus at school" << std::endl;


And jesus was cool. Well, he ued to drink too much, but he was cool.

Regards,

Share this post


Link to post
Share on other sites
sorry about not talking proper english
and no it dosnt say any thing when you type 15 im working on it ill post it on here when its fully done this is just a prototype

Share this post


Link to post
Share on other sites
Putting a little more effort into your grammar would be nice.

Quote:

I'm a newbie, too. I have just came up with a really funny program.

If you enter an age below 17 it says you're at a cool age, and if you enter an age above 20 it says you're ancient. If you enter an age between 17 and 20 it will say "not to old i suppose".

Compile this code and tell me what you think. Please tell me what I can do to improve it or make it funnier. Thanks.


To which I might reply


#include <iostream>
#include <limits>

using namespace std;

int main()
{
int age;

cout<<"Please input your age: "<<flush;

if(cin>>age)
{
if(age <= 5)
cout<<"Why do I not believe you?";
else if(age <= 16)
cout<<"That's a cool age.";
else if(age <= 20)
cout<<"That's about average I suppose.";
else if(age <= 90)
cout<<"Woah! You're ancient!\nOnly joking.";
else
cout<<"Why aren't you dead yet?";
}
else
cout<<"I have no idea what that means.";

cin.ignore(numeric_limits<int>::max(), '\n');

cout<<"\n\nPress enter to quit."<<endl;
cin.get();
}


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!