A Simple Example Of C++


#include <iostream>

using namespace std;

int main(){

cout<<“Welcome in C world With Codeverb”;

getch();

return 0;

}


Output:
Welcome in C++ world With Codeverb


Description


#include It’s a standard input output header files in which includes many types of predefiend function such as cout<<, cin>> etc.


int main() int is return type here and main is function name for compiler. program execution start from this function.


Why we use using namespace std in C++


It make so easy my code because other wise we have to write cout statements like this:() int is return type here and main is function name for compiler. program execution start from this function.


std::cout << "What ";

std::cout << "Are";

std::cout << "You are you doing with Your life!";

std::cout << "i hate STDS!";


So you provide the compiler the information that you will be using the class std very frequently so now that it knows this you don't have to keep on including the std:: in the beginning of each cout or cin statement.


  1. cout<< - This used for print any message in C++ on console just like printf in c.

  2. cin>>- This statement used for input any value into variable just like scanf in c but difference is that we don’t used here %d,%f,%s in C++.

  3. getch() function block the output screen until user not press any key.

  4. return 0; The return keyword is used for return a value but here we are not returning any value.