114k views
12 votes
Write a program that display your name c++

1 Answer

2 votes

Answer:

#include <iostream>

#include <string>

int main() {

std::string name;

std::cout << "Please enter a name: ";

std::cin >> name;

std::cout << "Hello " << name<<"!";

}

Step-by-step explanation:

Asks for your name and adds Hello {name}!

User Andreas Schwarz
by
3.4k points