-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain (1).cpp
More file actions
41 lines (35 loc) · 1.13 KB
/
Copy pathmain (1).cpp
File metadata and controls
41 lines (35 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <chrono>
#include <thread>
using std::cout;
using std::cin;
using std::endl;
void revisarTemperatura(int temperatura){
cout<<"revisando temperatura. Temperatura actual "<<temperatura<<"Cº"<<endl;
if(temperatura >= 30){
cout<<"Alerta temperatura alta"<<endl;
}
else{
cout<<"temperatura normal"<<endl;
}
}
int main()
{
srand(time(0));
while(true){
int tempSimulada1 = (rand()%26) + 15;
int tempSimulada2 = (rand()%26) + 15;
revisarTemperatura(tempSimulada1);
revisarTemperatura(tempSimulada2);
std::this_thread::sleep_for(std::chrono::seconds(1));
}
return 0;
}