String input in C++ programming is used to take string input from the user, scanf() is one of the commonly used function to take string input from the user.
#include<iostream.h>
#include<conio.h>
#include<string> //including Library for Working with String.
void main()
{
string str; //'str' used for String value.
str = "Bilal Khan Afridi"; //assigning value to 'str'.
cout<<"The Name is: "<<str<<endl; //and printing.
getch();
}
#include<iostream.h>
#include<conio.h>
#include<string> //including Library for Working with String.
void main()
{
string str; //'str' used for String value.
cout<<"Please Enter Ur Name: ";
cin>>str; //user Enter value storing in 'str'.
cout<<"The Name is: "<<str<<endl; //and printing.
getch();
}
#include<iostream.h>
#include<conio.h>
#include<math.h> //Including Library for Maths.
void main()
{
int a;
a = pow(3, 2); //assigning 3 Power 2 to 'a'.
cout<<"3 Power 2 is: "<<a; //and printing.
getch();
}