Created
January 13, 2022 22:33
-
-
Save CarbonHeartDev/20bff10fc4ae25d4aa093ded90d3f1da to your computer and use it in GitHub Desktop.
Esercizio risolto per skuola.net
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
int numero_persone; | |
float prezzo_totale_bus, prezzo_a_persona_treno; | |
cout << "Inserire il numero di persone "; | |
cin >> numero_persone; | |
cout << "Inserire il prezzo totale del bus "; | |
cin >> prezzo_totale_bus; | |
cout << "Inserire il prezzo a persona del treno "; | |
cin >> prezzo_a_persona_treno; | |
float prezzo_totale_treno = numero_persone * prezzo_a_persona_treno; | |
if(prezzo_totale_bus < prezzo_totale_treno){ | |
cout << "La scelta piu' conveniente e' il bus"; | |
} else if (prezzo_totale_bus == prezzo_totale_treno) { | |
cout << "Bus e treno hanno lo stesso prezzo"; | |
} else { | |
cout << "La scelta piu' conveniente e' il treno"; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment