Hi, guys, I need a little help. My program closes after the out even though i've used cin.get():. Can someone please help me? I want the program to stay open at least until you press enter, even after the whole output(dunno if i'm makin sense).
Please help me. Here is the code:
Code:#include <iostream>#include <string> int main() { std::cout << "Please enter your name"; std::string name; std::cin>> name; // build the message that we intend to write const std::string greeting = "Hello, " + name + "!"; //build the second and fourth lines of output const std:: string spaces(greeting.size(), ' '); const std::string second = "* " + spaces + " *"; //build the first and figth lines of the output const std::string first(second.size(), '*'); //write it all std::cout << std::endl; std::cout << first << std::endl; std::cout << second << std::endl; std::cout << "*" << greeting << "*" << std::endl; std::cout << second << std::endl; std::cout << first << std::endl; std::cin.get(); return 0; }