0
Je veux coder un petit exemple d'interpréteur de ligne de commande pour un programme plus grand. Mais si j'entre "1 2 3", la sortie est "1 \ n2 \ n3 \ n" et non "1 2 3 \ n" comme je m'y attendais.Un std :: endl fait trois std :: endl (s)?
#include <iostream>
int main(int argc, char **argv) {
while (true) {
std::string line;
std::cin >> line;
std::cout << line << std::endl;
}
return 0;
}
Ah OK Cin lit automatiquement, s'il y a plusieurs mots. –