ZFGC
Resources => Coding => Topic started by: Hero of Vortex on May 09, 2006, 09:16:08 pm
-
// I had an urge to program something...
// I know, I'm crazy.
#include <iostream>
using std::cout; // These were either made for the lazy or to save space.
using std::cin;
// I don't think I'll need any functions.
int main() // Start main program.
{
int YourNumber; // The variable that I'll use.
// Not that it changes anything. :D
cout << "Hello there.\n"; // Says a greeting.
cin.get(); // Some wierd thing I see on the internet a lot that
// is supposedly better than system pause but does the same thing. =\
cout << "I would very much like to \nknow your favorite number.\n"; // The indication of what to enter.
cin >> YourNumber; // This is how we input our variables. Input our variables,
// input our variables...
cout << "WTF? Your favorite number is "; // Insult. Note how putting
cout << YourNumber; // the variable there makes it show the number.
cout << "?! \n"; // Just putting this here to show that it is part of the insult.
cin.get(); // That wierd thingy again...
cout << "You're strange.\n"; // Last message and insult. :D
cin.get(); // THat thing one more time.
return 0; // Signal the compiler that everything was succesful.
} // The end of the main program! Though calling it "main" is kind of innacurate when
// there aren't any functions.
And you can see that when I say random, I MEAN random. >.>
-
I think you just wrote the long-awaited sequel to Hello World. :o Good job!
-
And just because im absolutly bored, i optimized it abit, and stuck it all in 2 lines XD
#include <iostream>
using namespace std; int main(int argc, char *argv[]) { int iNumber; cout << "Hello there.\nI would very much like to know your favorite number.\n>"; cin >> iNumber; cout << "WTF? Your favorite number is " << iNumber << "?!\nYou're strange.\n"; cin.get(); return EXIT_SUCCESS; }
-
This is so funny! ;D
-
This is so funny! ;D
Unfortanutely, since this is the internet, I can't tell if you mean that or if you're being sarcastic. >.> So I'll assume you mean it! >.> Thanks.
I think you just wrote the long-awaited sequel to Hello World. :o Good job!
People wanted a sequel to Hello World?
And just because im absolutly bored, i optimized it abit, and stuck it all in 2 lines XD
#include <iostream>
using namespace std; int main(int argc, char *argv[]) { int iNumber; cout << "Hello there.\nI would very much like to know your favorite number.\n>"; cin >> iNumber; cout << "WTF? Your favorite number is " << iNumber << "?!\nYou're strange.\n"; cin.get(); return EXIT_SUCCESS; }
That has things in there that I've never even heard of! O_O
-
using namespace std; int main(int argc, char *argv[])
I was about to post the same thing XD
-
using namespace std; int main(int argc, char *argv[])
I was about to post the same thing XD
Quite simple really, "using namespace std" just imports the std namespace so you can use its symbols(Functions, variables...what not).
The argc parameter is equal to the number of command-line parameters passed to this program.
The argv parameter is an array of the command-line parameters passed to this program.
-
the arguments are for windows-based console applications, for the most part yuo don't actually need them.
-
XD Nice program! ;) I'll have to remember that cin.get() thing.