Hi guys i wanted to make a tut a long time ago but ive ben lazzy!... srry though! anyways to start off with C++ u need a compiler i s***est Bloodshed-devC++ its beginner friendly
now lets get started shall we... once u get the compiler u go to project - console app - and u wrote the following
NOTE : // is a comment , the compiler ignores it
the preprocessor declares functions used in later (ex:cout in this prog)Code:#include<iostream> //preprocessor using namespace std; //it declares cout and cin.. (explaining later on) //Some people use std:: instead // before each function examples comming later on int main () // its where the code gets executed (the main function) { cout<<"Hello World"; //it basicly prints Hello world to the screen cin.get(); // it prevents the program from crashing }
and using namespace std; kinda does the same thing but if u aint gonna put it the program will be written like this :
NOTE : Never forget the semicolon , This ";" is very important , it tells the compiler that the function ends thereCode:#include<iostream> int main() { std::cout<<"Hello World"; //just a short example }
and if ur gonna write multiple stuff on the screen use endl
EX:
Well thats it for now ... i'll be explaining more later onCode:#include<iostream> using namespace std; int main() { cout<<"Hello World!" <<endl; // means new line ... cout<<"Hello Again!" ; cin.get(); }
and if u find any mistakes feel free to correct me :-)
hope u enjoyed it!
Happy programing!



!... srry though! anyways to start off with C++ u need a compiler i s***est Bloodshed-devC++ its beginner friendly
Reply With Quote