Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  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) Media media" << endl;
  20. cin >> pclasse;
  21. }
  22.  
  23.  
  24. int main() {
  25. string nome, cognome, risposta ;
  26. int tipostudente, classe, costo ;
  27.  
  28. do{ input(nome, cognome, tipostudente, classe) ;
  29.  
  30. switch (classe) {
  31. case 1:
  32. costo = 15;
  33. break;
  34. case 2:
  35. costo = 12;
  36. break;
  37. case 3:
  38. costo = 13;
  39. break;
  40. }
  41.  
  42. if (tipostudente = 2) {
  43. costo = costo + costo*0,10 ;
  44. }
  45.  
  46. costo = costo + costo*0,20 ;
  47.  
  48. cout << "Vuoi ripetere per un altro studente?" << endl;
  49. cin >> risposta;
  50.  
  51.  
  52. cout << "il nome dell'alunno e': " << nome << endl;
  53. cout << "il cognome dell'alunno e': " << cognome << endl;
  54. cout << "l'alunno frequenta la" << classe << "a media" << endl;
  55. cout << "il costo totale giornaliero equivale a:" << costo << endl;
  56.  
  57. } while (risposta == "SI" || risposta == "si");
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement