| View previous topic :: View next topic |
| Author |
Message |
DamiPL Grandmaster Cheater Supreme
Reputation: 3
Joined: 02 Jul 2006 Posts: 1195 Location: 11001110
|
Posted: Tue Feb 10, 2009 11:22 pm Post subject: [C++]Newb question~ |
|
|
ok so i wanted to learn C++ and got some cool vids(3d buzz tuts), im sure most of u seen em.
So my question is whats the diff in Microsoft Studio 2003 and 2008.
heres a ss:
The 1st one is 2003 one and on the vid it works.
on 2008 however it wont and its the same exact thing. Its like 2008 does not recognize the main function?
*i dont much about c++ so dont flame.
_________________
|
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Tue Feb 10, 2009 11:34 pm Post subject: |
|
|
"int main()"
EDIT: just watched some of their tut. Jesus fuck fucking Christ. Get a new tut. 25 minute video on Hello World? Such watered-down material is not conducive to learning. I suggest you check out the sticky and find another tut. http://www.cplusplus.com/doc/tutorial/ is generally recommended.
_________________
|
|
| Back to top |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Tue Feb 10, 2009 11:58 pm Post subject: |
|
|
| Code: | #include <iostream>
using namespace std; // *see comment at end
int main()
{
cout << "Hello World" << endl;
return 0;
} |
the "using namespace std; makes it so you dont have to out std:: in front of things like cout, cin, endl, etc. Also, have to declare the function type. Which is why you make it int main, because you chose "integer main" you are trying to get a value from your function, which is why you return 0.
Feel free to ask anymore questions, also, check out the site HalfPrime posted, it will teach you the basic syntax of c++ much better.
_________________
Last edited by manc on Sun Feb 15, 2009 12:47 am; edited 1 time in total |
|
| Back to top |
|
 |
DamiPL Grandmaster Cheater Supreme
Reputation: 3
Joined: 02 Jul 2006 Posts: 1195 Location: 11001110
|
Posted: Wed Feb 11, 2009 12:44 am Post subject: |
|
|
thx for the explanation and HalfPrime for the site, it will help alot.
one more thing, how can i make it so it does not exit after 1 sec.
I will read more of the site tomorrow but just wanna know that.
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Feb 11, 2009 12:54 am Post subject: |
|
|
1. you used ( ) instead of { } in your main function.
2. you can essentially wait for input by doing:
std::cin.sync();
std::cin.ignore();
or you can run your program from the command line.
3. never use void main.
|
|
| Back to top |
|
 |
|