Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- void input(string&pnome, string&pcognome, int&ptipostudente, int&pclasse){
- cout << "Inserisci nome: " ;
- cin >> pnome;
- cout << "Inserisci cognome: " ;
- cin >> pcognome;
- cout << "Inserisci tipo studente: " <<endl;
- cout << "(1) In corso" << endl;
- cout << "(2) Non in corso " << endl;
- cout << "(3) Anticipatario " <<endl;
- cin >> ptipostudente;
- cout << "Inserisci classe: " << endl;
- cout << "(1) Prima media" << endl;
- cout << "(2) Seconda media" << endl;
- cout << "(3) Terza media" << endl;
- cin >> pclasse;
- }
- int main() {
- string nome, cognome, risposta ;
- int tipostudente, classe ;
- float costo;
- do{
- input(nome, cognome, tipostudente, classe) ;
- switch (classe) {
- case 1:
- costo = 15;
- break;
- case 2:
- costo = 12;
- break;
- case 3:
- costo = 13;
- break;
- }
- if (tipostudente == 2) {
- costo = costo + costo*0,10 ; }
- costo = costo + costo*0,20 ;
- cout << "Vuoi ripetere per un altro studente?" << endl;
- cin >> risposta;
- cout << "//////////////////////////////////////////////" << endl;
- cout << "Il nome dell'alunno e': " << nome << endl;
- cout << "Il cognome dell'alunno e': " << cognome << endl;
- cout << "L'alunno frequenta la: " << classe << "^a media" << endl;
- cout << "Il costo totale giornaliero equivale a: " << costo << "euro "<< endl;
- cout << "//////////////////////////////////////////////" << endl;
- } while (risposta == "SI" || risposta == "si");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement