| View previous topic :: View next topic |
| Author |
Message |
User Error How do I cheat?
Reputation: 0
Joined: 17 Jan 2009 Posts: 0
|
Posted: Wed Mar 12, 2008 2:53 pm Post subject: C++ help? |
|
|
idk where to start
im trying to form a simple hello world.
I have the code
| Code: | #include <iostream.h>
main()
{
cout << "Hello CEF!";
return 0;
} |
now where and how do i put it in? pics=good.
using visual C++ espress 9.0
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Mar 12, 2008 2:56 pm Post subject: |
|
|
New empty project, right click in the solution explorer (top right) and add a .cpp file.
also, int main
also, std::cout
Last edited by hcavolsdsadgadsg on Wed Mar 12, 2008 2:58 pm; edited 1 time in total |
|
| Back to top |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Wed Mar 12, 2008 2:57 pm Post subject: |
|
|
Download Visual C++ 2008.
Install it.
Open it.
Click -> File -> New Project -> Empty Project.
Click -> Project -> Add new file -> C++ File(.cpp)
Copy and paste that code in.
Click Debug -> Start with out debugging.
I notice a little error in your code.
Add this in
| Code: | | using namespace std; |
_________________
What dosen't kill you, usually does the second time. |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed Mar 12, 2008 2:59 pm Post subject: |
|
|
Along with other errors, its:
#include <iostream>
Without the .h for that said file. And when you do get it to work and ask why it just closes, it is because you did not include a method to pause the console before closing. You can do that via:
| Code: | std::cin.ignore();
std::cin.sync(); |
Before your return.
_________________
- Retired. |
|
| Back to top |
|
 |
User Error How do I cheat?
Reputation: 0
Joined: 17 Jan 2009 Posts: 0
|
Posted: Wed Mar 12, 2008 3:32 pm Post subject: |
|
|
i did this, what is wrong here?
|
|
| Back to top |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Wed Mar 12, 2008 3:37 pm Post subject: |
|
|
| Code: |
#include <iostream>
using namespace std;
int main()
{
cout << "Hello CEF";
cin.ignore();
cin.sync();
return 0;
}
|
You also spelled hello 'helo'...
_________________
What dosen't kill you, usually does the second time. |
|
| Back to top |
|
 |
User Error How do I cheat?
Reputation: 0
Joined: 17 Jan 2009 Posts: 0
|
Posted: Wed Mar 12, 2008 4:00 pm Post subject: |
|
|
| HornyAZNBoy wrote: | | Code: |
#include <iostream>
using namespace std;
int main()
{
cout << "Hello CEF";
cin.ignore();
cin.sync();
return 0;
}
|
You also spelled hello 'helo'... |
I already had a project named hello lol.
so what should i do next?
|
|
| Back to top |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Wed Mar 12, 2008 4:15 pm Post subject: |
|
|
copy and paste my code int and press F5 to run it.
_________________
What dosen't kill you, usually does the second time. |
|
| Back to top |
|
 |
User Error How do I cheat?
Reputation: 0
Joined: 17 Jan 2009 Posts: 0
|
Posted: Wed Mar 12, 2008 4:32 pm Post subject: |
|
|
| HornyAZNBoy wrote: | | copy and paste my code int and press F5 to run it. |
No, i mean what should i do? Make something else? learn something? My friend told me the first thing to learn to do was "Hello World"
|
|
| Back to top |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Wed Mar 12, 2008 4:38 pm Post subject: |
|
|
Now make a calculator.
_________________
What dosen't kill you, usually does the second time. |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed Mar 12, 2008 5:53 pm Post subject: |
|
|
Stop and understand the code that was given to you first.
_________________
- Retired. |
|
| Back to top |
|
 |
User Error How do I cheat?
Reputation: 0
Joined: 17 Jan 2009 Posts: 0
|
Posted: Wed Mar 12, 2008 6:05 pm Post subject: |
|
|
One more thing, how do i save the hello world as a .exe? i debug it and it saves a .exe but when i send it to my other computer and try to use it it doesnt work.
EDIT: Nevermind, got it.
|
|
| Back to top |
|
 |
|