In the program I am working on one of the first things I need it to do is to read whitespace and the return key all into the same string. For instance, if I were to type(the dots represent spaces because I couldnt get the spaces to show properly by themselves):
...Happy
......Valentines day,
It would read the 3 spaces before happy, the enter key as a white space, the six spaces before Valentines day. So it would then come out like this.
"...Happy.......Valentines day" yes I did forget the comma on purpose, that is another part of the assignment in which I am supposed to seperate each string with a comma but I will not bother with that here.
As far as my code goes:
Code:
#include "std_lib_facilities.h" //a header made by Dr. Stroustrup for my class
int main() {
string string1;
cout << "Please enter a string: ";
getline(cin, string1);
cout << string1;
keep_window_open();
}
All it does now is accepts a string and reads all the whitespace and words you can put on one line. All I want it to do is to be able to hit enter and continue reading whitespace and words.