[Solved] I need help in c++ [closed]


You will need to use something like std::cin to take users input. Use something like a std::string container to hold the alphabetic answer i.e. yes or y. Then check your input against your control and conditionally print Hello World.

#include <iostream>
#include <string>

int main()
{
    std::string ans;
    std::cout << "Would you like to see the \"Hello World\"?\n-> ";
    std::cin >> ans;
    if (ans == "yes" || ans == "y")
    {
        std::cout << "\nHello World!" << std::endl;
    }
    return 0;
}

solved I need help in c++ [closed]