Message from C, C++ discussions
January 2020
— 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;
}
— /* run this program using the console pauser or add your own getch, system("pause") or input loop */
— 46 2 C:\Users\nicol\OneDrive\Documenti\main.cpp [Error] 'somma1' was not declared in this scope
— 46 25 C:\Users\nicol\OneDrive\Documenti\main.cpp [Error] 'to_string' was not declared in this scope
— Is it possible to cout a parameter of an object inside the destructor function?
— Player::~Player()
{
cout<<"Addio "<<player . name<<" :("<<endl;
}
— Thank you bad bot, player . name isn't a link
— No spaces between player.name
— OHHH nvm I get what happened
— I know, bot deleted
— You should be able to use this . name
or just call name directly as it's still within the scope of the class and has access to the fields