C++ Syntax or Program Structure with Working example : In this tutorial we will understand C++ Syntax or Program Structure with the help of a simple working programme called name.cpp, which take input and print name on screen.
About C++ as per Wikipedia
C++ (pronounced cee plus plus) is a general-purpose programming language. It has imperative, object-oriented and generic programming features, while also providing facilities for low-level memory manipulation.
IDE and compiler
- IDE : CodeBlocks
- Compiler : GCC
- Environment : Linux, Window 7
Create a file called name.cpp using Codeblocks or ide of your choice with code given below , compile and run it
#include <iostream>
using namescape std;
int main(){
char str[40];
cout<<"Enter your Name"; //cout used to print something
cin>>str; //cin used to received inputs
cout<<"Your Name is "<<str;
return 0;
}
Points To be Remember
- <iostream> means included header iostream.h
- The line using namespace std; tells the compiler to use the std namespace.
- // used for single line comment
- main() is where program execution begins.
- return 0; terminates main( ) function and causes it to return the value 0 to the calling process.
Will you publish more c++ tutorial with example …..
Soon I will publish a series of c and c++ tutorial