Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

[SOLVED] What's happened with my cout

$
0
0
Hello Qt World ! Is there somebody can explane at me why the display is different ? It’s very strange ! #include <iostream>   int add(int & a) {     a += 1;     return a; }   void enUneLigne(); void enPlusieursLignes();   int main() {     std::cout << "en une ligne:" << std::endl;         enUneLigne();     std::cout << std::endl << std::endl << "en plusieurs lignes:" << std::endl;         enPlusieursLignes(); return 0; }     void enUneLigne() {     int a(0);       std::cout <<     "1: " << add(a) << std::endl <<     "2: " << add(a) << std::endl <<     "3: " << add(a) << std::endl <<     "4: " << add(a) << std::endl; } void enPlusieursLignes() {     int a(0);       std::cout << "1: " << add(a) << std::endl;     std::cout << "2: " << add(a) << std::endl;     std::cout << "3: " << add(a) << std::endl;     std::cout << "4: " << add(a) << std::endl; } the display : Démarrage de \QT Projects\_Essai4\debug\_Essai4.exe...en une ligne: 1: 4 2: 3 3: 2 4: 1     en plusieurs lignes: 1: 1 2: 2 3: 3 4: 4 \QT Projects\_Essai4\debug\_Essai4.exe a quitté avec le code 0

Viewing all articles
Browse latest Browse all 18427

Trending Articles