Sharp Tutorial
input output in c++

Python

Java

C

C++

HTML/CSS

Java Script

PHP

SQL

C Programs

introduction to c++

  • C++ Home
  • Introduction to C++
  • History features
  • Sample Programs
  • cout , cin , endl
  • Data type and Operators
  • if else in c++
  • loop in c++

Oops in C++

  • Object / Class
  • Constructor
  • Function & Constructor Overloading
  • Inheritance
  • Overriding

Advanced C++

  • Strings in C++
  • Exception Handling
  • Special Functions
  • C++ Programs

output in c++(How to print)

cout is the command to print on the screen.

eg. cout<<” command to display on the screen”; 

cout to print

#include<iostream>
using namespace std;
int main()
{
cout<<"command to print using c++";
return 0;
 }

Output of the following program is as following.

append multiple values using <<

#include<iostream>
using namespace std;
int main()
{
string course="c++";
cout<<"we should learn "<<course;
return 0;
}

Output of the following program is as following.

<<endl to print output in the newline.

#include<iostream>
using namespace std;
int main()
{
string name="sameer";
int age=32;
cout<<"I am "<<name<<endl << " I stay at new delhi";
return 0;
}

Output of the following program is as following.

cin>> to take input using c++.
program to add two numbers input by user

#include<iostream>
using namespace std;
int main()
{
int a=0,b=0,sum;
cout<<"enter two numbers";
cin>>a;
cin>>b;
sum=a+b;
cout<<"the sum is"<<sum;
return 0;
}

Output of the following program is as following.

Enquiry about Course

Ask your Question

Click Here

Sharp (2) Tutorials

Video/ C Introduction

Watch video in full size

Video tutorial

Follow by Email
Facebook
Facebook
fb-share-icon
YouTube
Copyright © Sharp Tutorial
Build with WordPress
Wordpress Social Share Plugin powered by Ultimatelysocial
Sharp Tutorial