Connect with one of the following accounts


Please wait while we redirect...

Views: 193   

Following program shows you how to scan name of user and say hello with name
In this program we get name from user using std::cin method and prints hello with that name using std::cout

#include <iostream>
#include <string>

int main() {
    std::string name;
    std::cout << "Please enter a name:";
    std::cin >> name;
    std::cout << "Hello " << name;


Please enter a name: Tom
Hello Tom

On By

Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News