+ 1

can i help me?

#include <iostream> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char** argv){ int a,b,c,d; float risultato; //dichiarazione variabili intere cout<< "inserisci primo valore"; //visualizza messaggio in uscita cin >> a; //richiesta inserimento valore cout<< "inserisci secondo valore"; //visualizza messaggio in uscita cin>> c; //richiesta inserimento valore cout<< "inserisci terzo valore"; //visualizza messaggio in uscita cin>> c; //richiesta inserimento valore cout<< "inserisci quarto valore"; //visualizza messaggio in uscita cin>> d; cout<<risultato; if(a>b) { if(a>c) { if(a>d) { risultato=(b+c+d)/a; } } } else { if(b>a) { if(b>c) { if(b>d) { risultato=(a+c+d)/b; } } } } if(c>a) { if(c>b) { if(c>d) { risultato=(a+b+d)/c; } } } else { if(d>a) { if(d>b) { if(d>c) { risultato=(a+b+c)/d; } } } } return 0; }

21st Nov 2017, 5:41 PM
GiltDrake
GiltDrake - avatar
13 odpowiedzi
+ 7
Another error is, you mistakenly took input of c twice instead of b. Edit: it's still showing wrong output for some inputs, I'll fix and update soon. https://code.sololearn.com/c7ar7C66ni8G/?ref=app
21st Nov 2017, 6:07 PM
Shamima Yasmin
Shamima Yasmin - avatar
21st Nov 2017, 6:14 PM
John Wells
John Wells - avatar
+ 1
Your outputting risultato before your if statements.
21st Nov 2017, 6:01 PM
John Wells
John Wells - avatar
+ 1
it works thanks
21st Nov 2017, 6:36 PM
GiltDrake
GiltDrake - avatar
+ 1
Not a problem, one of the main reasons I'm here is to share my knowledge.
21st Nov 2017, 6:38 PM
John Wells
John Wells - avatar
0
four input values ​​add the three minors together and divide them into the largest
21st Nov 2017, 5:42 PM
GiltDrake
GiltDrake - avatar
0
I do not understand why it does not go
21st Nov 2017, 5:47 PM
GiltDrake
GiltDrake - avatar
0
i don't understand
21st Nov 2017, 6:01 PM
GiltDrake
GiltDrake - avatar
0
how you do it
21st Nov 2017, 6:03 PM
GiltDrake
GiltDrake - avatar
0
?
21st Nov 2017, 6:03 PM
GiltDrake
GiltDrake - avatar
0
thank
21st Nov 2017, 6:08 PM
GiltDrake
GiltDrake - avatar
0
it does not work
21st Nov 2017, 6:23 PM
GiltDrake
GiltDrake - avatar
0
Sorry. Forgot to force float math. Try now.
21st Nov 2017, 6:26 PM
John Wells
John Wells - avatar