aggiungi ciclo di ripetizione

This commit is contained in:
Vichingo455 2024-10-18 11:27:08 +00:00
parent 478062efb8
commit a1f3586793
1 changed files with 7 additions and 1 deletions

View File

@ -7,7 +7,9 @@ Sistema di allarme
#include <ctime>
using namespace std;
int main(void) {
int bit0 = 0, bit1 = 0, bit2 = 0, bit3 = 0, bit4 = 0, bit5 = 0, bit6 = 0, bit7 = 0;
int rifai = 1;
do {
int bit0 = 0, bit1 = 0, bit2 = 0, bit3 = 0, bit4 = 0, bit5 = 0, bit6 = 0, bit7 = 0;
// Imposta i sensori casualmente
srand(static_cast<unsigned int>(time(0)));
bit0 = std::rand() % 2;
@ -67,5 +69,9 @@ int main(void) {
else {
cout << "Bagno: ALLARME OFF" << endl;
}
cout << endl << "Vuoi ripetere l'operazione? Inserisci 1 (SI) o 0 (NO): ";
cin >> rifai;
cout << endl;
} while (rifai != 0);
return 0;
}