Message from C, C++ discussions

January 2020

— No, not italy

— 

I compiled it and it works but when I click send Nothing happens. I'll give you an example:
When the user clicks send the program closes. In Python it was enough to make input () but here?

— ?

— Just send your code

— Aah!

add to the end

std::string input;
std::cin >> input;

— 2 seconds

— If you are on windows, you can use system("pause");

— Yes, I'm on windows

— Add this to the end

— It should then stop there

— #include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#include <string>
#include <iostream>
int main(int argc, char** argv) {
int n1,n2,n3,max,me,min,somma,media;
string x;

cout << "inserisci il primo numero " ;
cin >> n1 ;
cout <<"inserisci il secondo numero " ;
cin>> n2,
cout<<"inserisci il terzo numero " ;
cin>> n3;
if (n1>n2)
{
me=n2;
max=n1;
}
else
{
me=n1;
max=n2;
}
if ( n3>max)
{
min=me;
me=max;
max=n3;
}
else
if ( n3>me)
{
min=me;
me=n3;
}

else
{
min=n3;
}
cout<<"orine crescente: " << min << " "<< me<< " " << max ;
cout<<"orine decrescente: " << max << " " << me << " " << min;
somma = n1 + n2 + n3;
somma1= to_string(somma);
cout<<"la somma è " >> str somma ;
media=(n1+n2+n3)/3;
cout<<"la media è" >> media;

cout<<"premi un tasto e clicca invio per terminare";
cin>>x;


}

Message permanent page

— /* run this program using the console pauser or add your own getch, system("pause") or input loop */