DEV Community

loading...

Discussion on: Daily Challenge #1 - String Peeler

Collapse
caleb_rudder profile image
Caleb Rudder • Edited

C++ that takes user input

string prompt = "Enter a string: ";
string userInput;

cout << prompt << endl;
getline(cin,userInput);

if (userInput.length() > 2) {

    userInput = userInput.substr(1, (userInput.length() - 2));

}

cout << userInput;
Forem Open with the Forem app