solution for accept name from user in C++

Recommended Answers

All 2 Replies

You want the user to enter their name?

Easy done via strings.

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

int main(){
    string name;
    cout<<"Insert your name: ";
    cout<<"Hello "<<name<<".\n";
    return (0);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.