In: Computer Science
Code:
--------
#include <iostream>
using namespace std;
int main()
{
string toyName;
cout<<"Enter the toy name to be displayed: ";
//cin>>toyName;
getline(cin,toyName);
//The above line will scan the keyboard inputs
//and store it to "toyName" variable
//Difference between "cin>>toyName" and "getline(cin,toyName)"
//is that firstone will store only one word whereas
//secondone will take whole line
cout<<"Toy Name entered by you is: "<<toyName;
return 0;
}
Output:
--------