Write a C++ program to illustrates how to read strings and numeric data
#include <iostream>
using namespace std;
int main()
{
string s;
cout<<"\nEnter a string: ";
//reading string data
cin>>s;
int num;
cout<<"\nEnter a numerical data: ";
//reading a numerical data
cin>>num;
cout<<"\nThe entered string is "<<s;
cout<<"\nThe entered integer is "<<num;
return 0;
}
Comments
Leave a comment