-
Notifications
You must be signed in to change notification settings - Fork 4
/
lab08.c
executable file
·51 lines (40 loc) · 1.09 KB
/
lab08.c
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
42
43
44
45
46
47
48
49
50
51
/* lab08.c
* =============================================================
* Name:
* Section:
* Purpose:
* =============================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include "advisory.h"
#include "unitTest.h"
#define RUNTESTS 0
int main(void) {
// This runs the unit tests when #define RUNTESTS is 1
if (RUNTESTS) {
runAllTests();
exit(0);
}
int ambientTemp = 0;
int windSpeed = 0;
int coldAdvise = NO_COLD_ADVISORY;
// user input
printf("enter the wind speed: ");
scanf("%d", &windSpeed);
printf("enter the ambient temp: ");
scanf("%d", &ambientTemp);
// get cold advisory level
coldAdvise = coldAdvisory(windSpeed, ambientTemp);
// output
if(coldAdvise == NO_COLD_ADVISORY) {
printf("There is no advisory ");
} else if(coldAdvise == COLD_ADVISORY) {
printf("There is a COLD ADVISORY ");
} else {
printf("There is a COLD WARNING ");
}
printf("for temp: %2d ", ambientTemp);
printf("and wind: %2d\n", windSpeed);
return 0;
}