Skip to main content

Lets get the basics right first!

So the first post was meant to explain the class and objects. Lets get into the syntactical knowledge of C++(You will love it!).

Input/Output -

In any language when you develop a software, it requires you to take the input and throw some output. In C++ it is pretty easy to do that.

I will explain it through a code snippet:

Input :

#include <iostream>

using namespace std;
int main(){
     int a;
     cin >> a;      // There is a variable "a". To take the input from the user we use "cin" along with      return 0;         the  >> that is overloaded to take the streaming input.
}

Output :

#include <iostream>

using namespace std;
int main(){
     int a;
     cin >> a;     
     cout << a; // We took the input in the previous line and now we are giving the output through                                cout along with "<<" operator overloaded for giving out output. 
     return 0;           
}


Comments