Basic Input/Output in C++

 #include<iostream>

using namespace std;

int main() {
    int num1,num2;
    cout<<"Enter the value of num1 :\n";/* '<<' is called Insertion operator */
    cin>>num1;  /* '>>' is called Extraction operator */
    cout<<"Enter the value of num2 :\n";
    cin>>num2;
    cout<<"The sum is : "<<num1+num2;
    return 0;
}

OUTPUT :

PS D:\C++Practicals> cd "d:\C++Practicals\" ; if ($?) { g++ Basic_Input_Output.cpp -o Basic_Input_Output } ; if ($?) { .\Basic_Input_Output } Enter the value of num1 : 15 Enter the value of num2 : 15 The sum is : 30 PS D:\C++Practicals>

Comments

Popular posts from this blog

Variable Scope & Data Types in C++

Constants, Manipulators and Operator Precedence in C++

Variable Scope and Data Types