Post: Answer Real Quick please C++
06-20-2011, 07:29 AM #1
wite_guy
I-<3-2-1/2-6
(adsbygoogle = window.adsbygoogle || []).push({}); I watched maybe 3 5 minute long videos about C++ and i made this now can someone tell me what i forgot or what i did wrong?
    
#include <iostream>
int main ()
{
using namespace std;

int favnum;
string favanimal;
string favperson;
string favplace;

cout << "What Is Your Favorite Number? " << endl;
cin >> favnum;

cout << "What is your favorite animal? " << endl;
cin >> favanimal;

cout << "What is your favorite persons Name? " << endl;
cin >> favperson;

cout << "What is your favorite place? " << endl;
cin >> favplace;

cout << "Your Favorite Number is " << favnum << endl;

cout << "Your Favorite Animal is " << favanimal << endl;

cout << "Your Favorite person is " << favperson << endl;

cout << "Your Favorite Place is " << favplace << endl;

cout << "And That is why youre cool" << endl;


system("pause");

return 0;
}
(adsbygoogle = window.adsbygoogle || []).push({});
06-20-2011, 08:08 AM #2
<Jimbo>
</Jimbo>
All that I see is a grammar mistake. That is fine.

You must login or register to view this content. Awesome face

Originally posted by guy View Post
I watched maybe 3 5 minute long videos about C++ and i made this now can someone tell me what i forgot or what i did wrong?
    
#include <iostream>
int main ()
{
using namespace std;

int favnum;
string favanimal;
string favperson;
string favplace;

cout << "What Is Your Favorite Number? " << endl;
cin >> favnum;

cout << "What is your favorite animal? " << endl;
cin >> favanimal;

cout << "What is your favorite persons Name? " << endl;
cin >> favperson;

cout << "What is your favorite place? " << endl;
cin >> favplace;

cout << "Your Favorite Number is " << favnum << endl;

cout << "Your Favorite Animal is " << favanimal << endl;

cout << "Your Favorite person is " << favperson << endl;

cout << "Your Favorite Place is " << favplace << endl;

cout << "And That is why youre cool" << endl;


system("pause");

return 0;
}
06-20-2011, 08:15 AM #3
Originally posted by guy View Post
I watched maybe 3 5 minute long videos about C++ and i made this now can someone tell me what i forgot or what i did wrong?
    
#include <iostream>
int main ()
{
using namespace std;

int favnum;
string favanimal;
string favperson;
string favplace;

cout << "What Is Your Favorite Number? " << endl;
cin >> favnum;

cout << "What is your favorite animal? " << endl;
cin >> favanimal;

cout << "What is your favorite persons Name? " << endl;
cin >> favperson;

cout << "What is your favorite place? " << endl;
cin >> favplace;

cout << "Your Favorite Number is " << favnum << endl;

cout << "Your Favorite Animal is " << favanimal << endl;

cout << "Your Favorite person is " << favperson << endl;

cout << "Your Favorite Place is " << favplace << endl;

cout << "And That is why youre cool" << endl;


system("pause");

return 0;
}


Code is fine. If you are using Visual C++ Express or Visual Studio you cannot remove any of the using ""; etc...
06-20-2011, 08:16 AM #4
wite_guy
I-<3-2-1/2-6
The first one that i made wouldnt open up for me..
06-20-2011, 10:33 PM #5
Looks completely fine to me, What prject type is it? Console application? Or what? maybe you need to start with "hello world". Also did you compile it at least? Compile it or debug or whatever and go into where the project file is saved. go to the folder named "bin" then find a folder named "release" after you go into that folder you should see the Exe file. double click it to open it. that should be it.
06-21-2011, 01:19 AM #6
wite_guy
I-<3-2-1/2-6
Originally posted by xX View Post
Looks completely fine to me, What prject type is it? Console application? Or what? maybe you need to start with "hello world". Also did you compile it at least? Compile it or debug or whatever and go into where the project file is saved. go to the folder named "bin" then find a folder named "release" after you go into that folder you should see the Exe file. double click it to open it. that should be it.

no iwatched like 3 5 min videos so what you just said i was like huh but i did compile and run it the code is fine but it gave me an error on my computer
06-21-2011, 02:20 AM #7
First of all, to use the system("PAUSE"), you need to #include <stdlib.h> the standard library for windows since system("PAUSE") only works on windows machines. Also some compilers require you to include string. This code should work perfectly.

    #include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
int main ()
{

int favnum;
string favanimal;
string favperson;
string favplace;

cout << "What Is Your Favorite Number? " << endl;
cin >> favnum;

cout << "What is your favorite animal? " << endl;
cin >> favanimal;

cout << "What is your favorite persons Name? " << endl;
cin >> favperson;

cout << "What is your favorite place? " << endl;
cin >> favplace;

cout << "Your Favorite Number is " << favnum << endl;

cout << "Your Favorite Animal is " << favanimal << endl;

cout << "Your Favorite person is " << favperson << endl;

cout << "Your Favorite Place is " << favplace << endl;

cout << "And That is why youre cool" << endl;


system("pause");

return 0;
}

The following user thanked MoBaTeY for this useful post:

wite_guy
06-21-2011, 03:05 AM #8
Hmm i cant beleive i didnt notice that haha. But im still curious as to what type of project it was... looks like console application to me xD
06-21-2011, 11:53 PM #9
wite_guy
I-<3-2-1/2-6
Originally posted by xX View Post
Hmm i cant beleive i didnt notice that haha. But im still curious as to what type of project it was... looks like console application to me xD

Yeah i was just meessing around Smile

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo