Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5.  
  6. void input(string&pnome, string&pcognome, int&ptipostudente, int&pclasse){
  7. cout << "Inserisci nome: " ;
  8. cin >> pnome;
  9. cout << "Inserisci cognome: " ;
  10. cin >> pcognome;
  11. cout << "Inserisci tipo studente: " <<endl;
  12. cout << "(1) In corso" << endl;
  13. cout << "(2) Non in corso " << endl;
  14. cout << "(3) Anticipatario " <<endl;
  15. cin >> ptipostudente;
  16. cout << "Inserisci classe: " << endl;
  17. cout << "(1) Prima media" << endl;
  18. cout << "(2) Seconda media" << endl;
  19. cout << "(3) Terza media" << endl;
  20. cin >> pclasse;
  21. }
  22.  
  23.  
  24. int main() {
  25. string nome, cognome, risposta ;
  26. int tipostudente, classe ;
  27. float costo;
  28.  
  29. do{
  30.  
  31.  
  32. input(nome, cognome, tipostudente, classe) ;
  33.  
  34. switch (classe) {
  35. case 1:
  36. costo = 15;
  37. break;
  38. case 2:
  39. costo = 12;
  40. break;
  41. case 3:
  42. costo = 13;
  43. break;
  44. }
  45.  
  46. if (tipostudente == 2) {
  47. costo = costo + costo*0,10 ; }
  48.  
  49. costo = costo + costo*0,20 ;
  50.  
  51.  
  52. cout << "Vuoi ripetere per un altro studente?" << endl;
  53. cin >> risposta;
  54.  
  55. cout << "//////////////////////////////////////////////" << endl;
  56.  
  57. cout << "Il nome dell'alunno e': " << nome << endl;
  58. cout << "Il cognome dell'alunno e': " << cognome << endl;
  59. cout << "L'alunno frequenta la: " << classe << "^a media" << endl;
  60. cout << "Il costo totale giornaliero equivale a: " << costo << "euro "<< endl;
  61.  
  62. cout << "//////////////////////////////////////////////" << endl;
  63.  
  64. } while (risposta == "SI" || risposta == "si");
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement