Hello guys! time to learn c++ eh...
in this tutorial:
- show you what many functions mean..
- make a little program..
Requiments:
- use Dev c++
- a brain?
open your c++ make a new Console Application
(or just make a Source File CTRL+N)
if you take the Console Application you will see some codes...
and u wont do that in Source File..
the code is:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
system("PAUSE");
return EXIT_SUCCESS;
}
something like that... now im gonna teach you what this is...
iostream it has many functions like cout...
cout is a command that says something you want.. like cout << "hello everyone!";
using namespace std it will well, use the keyboard if you use a Pause function..
int main( ) that should ALLWAYS been in the project its the source in your program..
the { means the code should be here it starts here... example:
int main()
{
cout << "hello mmowned!?";
}
the main will say hello mmowned but you need #include <iostream> for the operator
cout is included there.
the other } its a block.. it will stop the code.
system(""); its a good command many things can used there.. like PAUSE it will pauses program and
say Press any key to continue...
if you use system("Pause >nul"); it will have a pause function but it wont show you the text. (could be usefull)
return EXIT_SUCCESS; means it will exit the program if its done everything right.
Other:
in the other tutorials i have checked in mmowned everyone is
using \n its make new line.. but why not use << endl;
it will end the line there and its much easier..
// means its a comment it wont make something in the program..
example //HELLO THIS IS CRAZY
lets make a program now:
first you will start with a Source File in dev c++ hold CTRL+N
now write:
#include <cstdlib>
#include <iostream>
#include <windows.h>
using namespace std;
int main(int argc, char *argv[])
{
char ourstring[50] = "As you know.. C++ ownz!";
int len = strlen(ourstring);
for (int i = 0; i < len; i++)
{
cout << ourstring[i];
Sleep(100);
}
//====================================
cout << "\n";
system("PAUSE");
}
and press F9 the program now will auto write a cool text
called "As you know.. C++ ownz!" you can change that in the code
thanks everybody for watching!!
make now some funny program
//olloX