[SOLVED] What's happened with my cout<< ?
General and Desktop
3
Posts
2
Posters
1.3k
Views
1
Watching
-
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: 1en plusieurs lignes:
1: 1
2: 2
3: 3
4: 4
\QT Projects_Essai4\debug_Essai4.exe a quitté avec le code 0@ -
thank you for your response !
Have a nice evening.