A Simple Example Of C++
using namespace std;
cout<<“Welcome in C world With Codeverb”;
Welcome in C++ world With Codeverb
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.
- cout<< - This used for print any message in C++ on console just like printf in c.
- 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++.
- getch() function block the output screen until user not press any key.
- return 0; The return keyword is used for return a value but here we are not returning any value.
© 2016-2019, Codeverb.com - All Rights Reserved