FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


C++ Question





tony
I have posted a question about the C++ hello world source code on...

http://www.wikicode.frihost.net/index.php?title=Talk:C_Plus_Plus:Hello_world

Would someone take the time to answer? If you would like, you may simply answer directly on the wiki.
yule
Very good code, thank you very much for your sharing .
Defsanguje
..
BlackSkad
The main-function should indeed have a return-value. And the way headers are included is the c-way, not the c++way.
But check my respons at the discussion for more information
dandelion
BlackSkad wrote:
The main-function should indeed have a return-value...

The main function must return an int value.
Also it must be declared as int instead of void.
Code:

int main() {
    // insert your code here
    return 0;
}
hamik
Actually you only return a int if it is int main.And you need to put cin.get(); or something like that to keep the window from closing.
the_furious1
I am not sure what is your question, but here is the actual C++ code for Hello World program:

Code:

#include <iostream.h>

int main()
{
   cout << "Hello World!\n";
   cout << "Press ENTER to continue..." << endl;
   getch ();
   
   return 0;
}
yjwong
Whats getch(); for? I don't think its required cause I don't need that.
BlackSkad
The getch(); isn't required, but if you leave it, the black screen will pop-up for less the a second and will disappear again. In this way, the window remains open.
You can also achieve this by using 'system("PAUSE");' from the c-lib stdlib (You don't have to cout the sentence "Press blabla..." by using this).

BlackSkad
eldarc
Can i C++ Become for free.

P.S: Sory for my bad English
Defsanguje
..
eldar
And the link for the free C++ is: Question Question Question Question
BlackSkad
mabybe this link to google can help you:
Free c++ compiler
The second link is a good one, I tried it myself for a while, but I stopped learning c++ at the moment. I'm thinking in java now Smile
See it yourself and maybe check some other links...

BlackSkad[/url]
tony
BlackSkad wrote:
mabybe this link to google can help you:
Free c++ compiler
The second link is a good one, I tried it myself for a while, but I stopped learning c++ at the moment. I'm thinking in java now Smile
See it yourself and maybe check some other links...

BlackSkad[/url]


gah - why are you thinking in java?
Related topics
[Question] Visual Basic C++, PHP, mySQL language guides...
IP Class C portioning
question aux codeurs ! php noob InsiDe!!
[C#] Safe place to store information
Custom encryption + program
la vie des etudiants noir en russie
C > Chr() in C++??
A C program in Linux
VB.Net Or C#
Quick Question in C language
Some not so commonly asked questions.
A confusion with C# and VB.NET...
[C] Splitting names program
C# or 3Ds max or FL studio teaching needed 500Frih$
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.