Advertisement
Guest User

Untitled

a guest
Aug 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. int main () {
  8. int L;
  9. int M;
  10. int A;
  11. int G;
  12. int contatore = 0;
  13.  
  14. srand((unsigned)time(NULL));
  15.  
  16. L = rand() % 4;
  17.  
  18. while (contatore == 0) {
  19. A = rand() % 4;
  20. if (A == L) {}
  21. else {
  22. contatore++;
  23. }
  24. }
  25.  
  26. while (contatore == 1) {
  27. M = rand() % 4;
  28. if (M == L) {}
  29. if (M == A) {}
  30. else {
  31. contatore++;
  32. }
  33. }
  34.  
  35. while (contatore == 2) {
  36. G = rand() % 4;
  37. if (G == L) {}
  38. if (G == A) {}
  39. if (G == M) {}
  40. else {
  41. contatore++;
  42. }
  43. }
  44.  
  45. cout << "Lucia deve ";
  46. switch (L) {
  47. case 0: cout << "lavare i piatti" << endl;
  48. break;
  49. case 1: cout << "sparecchiare" << endl;
  50. break;
  51. case 2: cout << "pulire il pavimento" << endl;
  52. break;
  53. case 3: cout << "fare il jolly" << endl;
  54. }
  55.  
  56. cout << "Adele deve ";
  57. switch (A) {
  58. case 0: cout << "lavare i piatti" << endl;
  59. break;
  60. case 1: cout << "sparecchiare" << endl;
  61. break;
  62. case 2: cout << "pulire il pavimento" << endl;
  63. break;
  64. case 3: cout << "fare il jolly" << endl;
  65. }
  66.  
  67. cout << "Maria deve ";
  68. switch (M) {
  69. case 0: cout << "lavare i piatti" << endl;
  70. break;
  71. case 1: cout << "sparecchiare" << endl;
  72. break;
  73. case 2: cout << "pulire il pavimento" << endl;
  74. break;
  75. case 3: cout << "fare il jolly" << endl;
  76. }
  77.  
  78. cout << "Giovanni deve ";
  79. switch (G) {
  80. case 0: cout << "lavare i piatti" << endl;
  81. break;
  82. case 1: cout << "sparecchiare" << endl;
  83. break;
  84. case 2: cout << "pulire il pavimento" << endl;
  85. break;
  86. case 3: cout << "fare il jolly" << endl;
  87. }
  88.  
  89. return 0;
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement