samedi 13 juillet 2019

cin not recording full string [duplicate]

This question already has an answer here:

IDK how to explain, but im just gonna simply say that cin isnt working like expected...

#include <iostream>
#include <string>
using namespace std;

string str;

int main() {
    cout << ">>";
    cin >> str;
    cout << str;
}

and when i input "i like sponge" it would print out "i" and when i input "sub to pewdiepie" it would print out "sub". im using repl.it (so i can access and run the code wherever i want) and idk if its a problem with that or whatever. if its just a problem with the editor, im just gonna switch to dev c++.

Aucun commentaire:

Enregistrer un commentaire