| View previous topic :: View next topic |
| Author |
Message |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Sat Aug 11, 2007 11:03 am Post subject: [HELP] C++ Hello World Program |
|
|
I'm using Dev-C++ as my complier and when I try a simple Hello World program, I keep getting an error. Tell me what I'm doing wrong.
| Code: | #include <iostream>
using namespace std;
int main (void)
{
cout << "Hello World!" ;
return 0;
} |
I keep getting this error
| Code: | | [Resource error] no resources |
_________________
What dosen't kill you, usually does the second time. |
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Sat Aug 11, 2007 11:19 am Post subject: |
|
|
I dont know C++, but I dun the Hello World tut and I remember that there is somehting with cin.get.
and I googled for it.
Thats it:
| Code: | #include<iostream>
using namespace std;
int main()
{
cout<<"Hello World\n";
cin.get();
} |
|
|
| Back to top |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Sat Aug 11, 2007 11:25 am Post subject: |
|
|
I'm sure \n is for line break. And when I started to learn C++ (yesterday) I was reading a book that says you don't need the cin.get();. The book I read is called C++ for the Absolute Beginner. _________________
What dosen't kill you, usually does the second time. |
|
| Back to top |
|
 |
magicalimp Expert Cheater
Reputation: 0
Joined: 03 Dec 2006 Posts: 105
|
Posted: Sat Aug 11, 2007 1:27 pm Post subject: |
|
|
| There's nothing wrong with your coding. Something may be off with your installation. |
|
| Back to top |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Sat Aug 11, 2007 1:57 pm Post subject: |
|
|
Then can you tell me which compiler I should use.
EDIT
There isn't a lot of people here. _________________
What dosen't kill you, usually does the second time. |
|
| Back to top |
|
 |
TheSorc3r3r I post too much
Reputation: 0
Joined: 06 Sep 2006 Posts: 2404
|
Posted: Sat Aug 11, 2007 2:02 pm Post subject: |
|
|
MVC++ _________________
Don't laugh, I'm still learning photoshop! |
|
| Back to top |
|
 |
merkark12 Advanced Cheater
Reputation: 0
Joined: 04 Jul 2007 Posts: 74 Location: In that program you just downloaded
|
Posted: Sat Aug 11, 2007 2:46 pm Post subject: |
|
|
[color=yellow]Yea use Visual c++ and instead of Dev
| Code: | #include <iostream>
using namespace std;
int main (void)
{
cout << "Hello World!" ;
return 0;
} |
take out the void but keep the ()
Edit:forgot instead of Dev _________________
|
|
| Back to top |
|
 |
suprat Cheater
Reputation: 0
Joined: 14 Jul 2007 Posts: 40
|
Posted: Sat Aug 11, 2007 2:56 pm Post subject: reinstall dev, and use c++ for dummies |
|
|
i have dev c++, and i have c++ for dummies book, i have tried ur code and it worked well.
and here is a better code :
#include <iostream>
using namespace std;
int main()
{
cout << "Hello Fuckers!!!!!!!!!! " << endl;
system("pause"); ///to stop the program from closing by it self
return 0;
}
enjoy |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sat Aug 11, 2007 4:24 pm Post subject: |
|
|
cin.get(); just stops the program from closing itself until u press any key
same goes for system("pause") as stated.
Forget Dev C++, it sux ass.
just get Visual C++ 2005 Express Edition or Download Visual Studio 2005 Proffessional from a Warez Forum.
and yes, \n is new line
most used of those:
\n - New Line
\t - Tab
\b - Backspace
\? - Question Mark
\' - Single Quote
\" - Double Quote
theres a couple more. but u hardly use them.
and when you put int main() instead of int main(void) theres no difference, when u leave brackets blank it automaticcly substitutes it for void no matter what u do, u just dont see it. _________________
|
|
| Back to top |
|
 |
gamesguru Grandmaster Cheater
Reputation: 0
Joined: 22 Mar 2006 Posts: 926 Location: detroit
|
Posted: Sat Aug 11, 2007 5:28 pm Post subject: |
|
|
Console::WriteLine(string Text);? _________________
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sat Aug 11, 2007 5:29 pm Post subject: |
|
|
| gamesguru wrote: | | Console::WriteLine(string Text);? |
thats a Console Application, not a Empty CLR Project. _________________
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Sat Aug 11, 2007 6:08 pm Post subject: |
|
|
Im no expert, but try this:
| Code: |
#include <io.h>
main()
{
printf('Hello Screen');
return 0;
}
|
C. |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sat Aug 11, 2007 6:23 pm Post subject: |
|
|
hes trying to learn C++, not C basics.... _________________
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Sat Aug 11, 2007 6:47 pm Post subject: |
|
|
| That code is fine, it's your compiler. Get a new one like Microsofts. |
|
| Back to top |
|
 |
magicalimp Expert Cheater
Reputation: 0
Joined: 03 Dec 2006 Posts: 105
|
Posted: Sat Aug 11, 2007 9:43 pm Post subject: |
|
|
| Kaspersky wrote: | Im no expert, but try this:
| Code: |
#include <io.h>
main()
{
printf('Hello Screen');
return 0;
}
|
C. |
stdio.h ? |
|
| Back to top |
|
 |
|