Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Jan 17, 2021
Embed
What would you like to do?
#include<iostream>
#include<string>
using namespace std;
int main(){
string prompt("What is your name? :"),
name,
line(40, '-'),
total = "Hello ";
cout<<prompt;
getline(cin, name);
total = total + name;
cout<<line<<endl<<total<<endl;
cout<<" Your name is "<<name.length()<<" characters long."<<endl;
cout<<line<<endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment