I want to create a program which allows the user to type multi-line input into the console, and then when they press a certain key, in this case it would be the key F, input will stop and everything is stored into the string called input.
This string should have all the input the user entered, including white spaces, new lines, etc. I want it to be a string that can be parsed later on in the program.
#include <iostream>
#include <vector>
using namespace std;
int main() {
string input;
while(cin >> input){
// Code for exiting the loop when the key "K" is pressed should be put here.
}
}
1 Answer