0

How to input and print names with string data type?

Click to see Output of the code

#include <iostream>
#include <string>
using namespace std;

int main(){

string name;
cout<<"Enter your first name: ";
cin>>name;
cout<<"your first name is: "<<name<<endl;

string naam;
cout<<"Now Enter your full name: ";
getline(cin,naam);
cout<<"Your Fullname is: "<<naam<<endl;

return 0;
}
vinzee
  • 17,022
  • 14
  • 42
  • 60

0 Answers0