Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <ctime>
- using namespace std;
- int main () {
- int L;
- int M;
- int A;
- int G;
- int contatore = 0;
- srand((unsigned)time(NULL));
- L = rand() % 4;
- while (contatore == 0) {
- A = rand() % 4;
- if (A == L) {}
- else {
- contatore++;
- }
- }
- while (contatore == 1) {
- M = rand() % 4;
- if (M == L) {}
- if (M == A) {}
- else {
- contatore++;
- }
- }
- while (contatore == 2) {
- G = rand() % 4;
- if (G == L) {}
- if (G == A) {}
- if (G == M) {}
- else {
- contatore++;
- }
- }
- cout << "Lucia deve ";
- switch (L) {
- case 0: cout << "lavare i piatti" << endl;
- break;
- case 1: cout << "sparecchiare" << endl;
- break;
- case 2: cout << "pulire il pavimento" << endl;
- break;
- case 3: cout << "fare il jolly" << endl;
- }
- cout << "Adele deve ";
- switch (A) {
- case 0: cout << "lavare i piatti" << endl;
- break;
- case 1: cout << "sparecchiare" << endl;
- break;
- case 2: cout << "pulire il pavimento" << endl;
- break;
- case 3: cout << "fare il jolly" << endl;
- }
- cout << "Maria deve ";
- switch (M) {
- case 0: cout << "lavare i piatti" << endl;
- break;
- case 1: cout << "sparecchiare" << endl;
- break;
- case 2: cout << "pulire il pavimento" << endl;
- break;
- case 3: cout << "fare il jolly" << endl;
- }
- cout << "Giovanni deve ";
- switch (G) {
- case 0: cout << "lavare i piatti" << endl;
- break;
- case 1: cout << "sparecchiare" << endl;
- break;
- case 2: cout << "pulire il pavimento" << endl;
- break;
- case 3: cout << "fare il jolly" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement