-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathVitalSignsInterpreter.c
537 lines (432 loc) · 15.6 KB
/
VitalSignsInterpreter.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
/*
Title : Vital Signs Interpreter
Author: @Rukawaaaaa
*/
#include <stdio.h>
int main(){
int upperbp, lowerbp, pulse, respiration;
int opt, opt1, opt2, score = 0, restart;
float temp;
char name [50];
do{
printf("-----------------------------------------------\n");
printf(" Vital Signs Interpreter \n");
printf("----------------------------------------------\n");
printf("I'm Rukawaaaaa, your vital signs interpreter.\n");
printf("> What should I call you: ");
scanf("%s" ,&name);
printf("----------------------------------------------\n");
printf("My system is not sensitive of your age and sex.\n" ,name);
printf("> Do you still wish to continue? 1) Yes 2) No:\n");
printf("----------------------------------------------\n");
printf("> %s, enter the number of your choice: " ,name);
scanf("%d" ,&opt1);
//Outer switch
switch(opt1){
case 1:
printf("----------------------------------------------\n");
printf("\t\tOptions: \n");
printf("\t1. Temperature\n");
printf("\t2. Pulse rate\n");
printf("\t3. Respiration rate\n");
printf("\t4. Blood pressure\n");
printf("\t5. Check all vital signs\n");
printf("\t6. See Legend\n");
printf("----------------------------------------------\n");
printf("> %s, enter the number of your choice: " ,name);
scanf("%d" ,&opt);
printf("----------------------------------------------\n");
//Nested switch
switch (opt)
{
//Temperature
case 1:
printf("> Enter your temperature in degree celsius: ");
scanf("%f" ,&temp);
printf("----------------------------------------------\n");
printf("Vital Sign Readings:\n");
if (temp < 36.1){
score++;
printf("* %s, your temperature is low.\n" ,name);
printf("* You may be experiencing hypothermia.\n");
}
else if (temp >= 36.1 && temp <= 37.2){
printf("* %s, your temperature is normal.\n" ,name);
}
else if (temp > 37.2 && temp < 40){
score++;
printf("* %s, your temperature is high.\n" ,name);
printf("* You have a febrile temperature.\n");
}
else if (temp >= 40){
score++;
printf("* %s, your temperature is extremely high.\n" ,name);
printf("* You're experiencing hyperthermia.\n");
}
else printf("* An error has occured. Invalid input! Try again.\n");
printf("----------------------------------------------\n");
printf("# Abnormalities found: %d\n" ,score);
printf("----------------------------------------------\n");
printf("\t\tOptions: \n");
printf("\t1. Restart Program\n");
printf("\t2. End Program\n");
printf("----------------------------------------------\n");
printf("> %s, enter the number of your choice: " ,name);
scanf("%d" ,&opt2);
printf("----------------------------------------------\n");
//Nested switch
switch(opt2)
{
case 1:
printf("\t\tRestarting Program...\n" ,name);
break;
case 2:
printf("Thank you for using Rukawaaaaa, %s!" ,name);
break;
default:
printf("An error has occured. Invalid input! Try again.\n");
}
break;
//Pulse rate
case 2:
printf("> Enter your pulse rate per minute: ");
scanf("%d" ,&pulse);
printf("----------------------------------------------\n");
printf("Vital Sign Readings:\n");
if (pulse <= 35){
score++;
printf("* %s, your pulse rate is critically low.\n" ,name);
printf("* You're experiencing bradycardia.\n");
}
else if (pulse > 35 && pulse < 50){
printf("* %s, your pulse rate is lower than normal.\n" ,name);
printf("* However, it is typical for athletic people.\n");
}
else if (pulse >= 50 && pulse <=90){
printf("* %s, your pulse rate is normal.\n" ,name);
}
else if (pulse > 90 && pulse <= 100){
score++;
printf("* %s, your pulse rate is reaching risk territory.\n" ,name);
printf("* You may be experiencing tachycardia.\n");
}
else if (pulse > 100){
score++;
printf("* %s, your pulse rate is extremely high.\n" ,name);
printf("* You're experiencing tachycardia.\n");
}
else printf("* An error has occured. Invalid input! Try again.\n");
printf("----------------------------------------------\n");
printf("# Abnormalities found: %d\n" ,score);
printf("----------------------------------------------\n");
printf("\t\tOptions: \n");
printf("\t1. Restart Program\n");
printf("\t2. End Program\n");
printf("----------------------------------------------\n");
printf("> %s, enter the number of your choice: " ,name);
scanf("%d" ,&opt2);
printf("----------------------------------------------\n");
switch(opt2){
case 1:
printf("\t\tRestarting Program...\n" ,name);
break;
case 2:
printf("Thank you for using Rukawaaaaa, %s!" ,name);
break;
default:
printf("An error has occured. Invalid input! Try again.\n");
}
break;
//Respiration rate
case 3:
printf("> Enter your respiration rate per minute: ");
scanf("%d" ,&respiration);
printf("----------------------------------------------\n");
printf("Vital Sign Readings:\n");
if (respiration < 10){
score++;
printf("* %s, your breathing rate is below normal.\n" ,name);
printf("* You're experiencing hypoventilation.\n");
}
else if (respiration >= 10 && respiration <=20){
printf("* %s, your breathing rate is normal.\n" ,name);
}
else if (respiration > 20){
score++;
printf("* %s, your breathing rate is above normal.\n" ,name);
printf("* You're hyperventilating.\n");
}
else printf("* An error has occured. Invalid input! Try again.\n");
printf("----------------------------------------------\n");
printf("# Abnormalities found: %d\n" ,score);
printf("----------------------------------------------\n");
printf("\t\tOptions: \n");
printf("\t1. Restart Program\n");
printf("\t2. End Program\n");
printf("----------------------------------------------\n");
printf("> %s, enter the number of your choice: " ,name);
scanf("%d" ,&opt2);
printf("----------------------------------------------\n");
//Nested switch 2
switch(opt2){
case 1:
printf("\t\tRestarting Program...\n" ,name);
break;
case 2:
printf("Thank you for using Rukawaaaaa, %s!" ,name);
break;
default:
printf("An error has occured. Invalid input! Try again.\n");
}
break; //End of nested switch 2
//Blood pressure
case 4:
printf("> Enter your systolic blood pressure: ");
scanf("%d", &upperbp);
printf("> Enter your diastolic blood pressure: ");
scanf("%d", &lowerbp);
printf("----------------------------------------------\n");
printf("Vital Sign Readings:\n");
if (upperbp <= 90 && lowerbp <= 60){
score++;
printf("* %s, your blood pressure is low.\n" ,name);
printf("* You are experiencing hypotension.\n");
}
else if (upperbp < 120 && lowerbp < 80)
{
printf("* %s, your blood pressure is normal.\n" ,name);
}
else if (upperbp <= 129 && lowerbp < 80)
{
score++;
printf("* %s, your blood pressure is elevated.\n" ,name);
}
else if (upperbp <= 139 && lowerbp <= 89)
{
score++;
printf("* %s, your blood pressure is high.\n" ,name);
printf("* Level: High Blood Pressure (Stage 1)\n");
}
else if (upperbp >= 140 && lowerbp >= 90)
{
score++;
printf("* %s, your blood pressure is alarmingly high.\n" ,name);
printf("* Level: High Blood Pressure (Stage 2)\n");
}
else if (upperbp > 180 && lowerbp <= 150)
{
score++;
printf("* %s, your blood pressure is extremely high.\n" ,name);
printf("* You are experiencing a hypertensive crisis.\n");
}
else printf("* An error has occured. Invalid input! Try again.\n");
printf("----------------------------------------------\n");
printf("# Abnormalities found: %d\n" ,score);
printf("----------------------------------------------\n");
printf("\t\tOptions: \n");
printf("\t1. Restart Program\n");
printf("\t2. End Program\n");
printf("----------------------------------------------\n");
printf("> %s, enter the number of your choice: " ,name);
scanf("%d" ,&opt2);
printf("----------------------------------------------\n");
switch(opt2){
case 1:
printf("\t\tRestarting Program...\n" ,name);
break;
case 2:
printf("Thank you for using Rukawaaaaa, %s!" ,name);
break;
default:
printf("An error has occured. Invalid input! Try again.\n");
}
break;
//Check all vital signs at once
case 5:
printf("Checking all vital signs...\n");
printf("> Enter your temperature in degree celsius: ");
scanf("%f" ,&temp);
printf("> Enter your pulse rate per minute: ");
scanf("%d" ,&pulse);
printf("> Enter your respiration rate per minute: ");
scanf("%d" ,&respiration);
printf("> Enter your systolic blood pressure: ");
scanf("%d", &upperbp);
printf("> Enter your diastolic blood pressure: ");
scanf("%d", &lowerbp);
printf("----------------------------------------------\n");
printf("%s, here are your vital sign readings...\n" ,name);
//Temperature
printf("> Temperature:\n");
if (temp < 36.1){
score++;
printf("* Your temperature is low.\n");
printf("* You are experiencing hypothermia.\n");
}
else if (temp > 36.1 && temp < 37.2){
printf("* Your temperature is normal.\n");
}
else if (temp > 37.2){
score++;
printf("* Your temperature is high.\n");
printf("* You are experiencing hyperthermia.\n");
}
else printf("* An error has occured. Invalid input! Try again.\n");
//Pulse rate
printf("> Pulse Rate:\n");
if (pulse <= 35){
score++;
printf("* Your pulse rate is critically low.\n");
printf("* You're experiencing bradycardia.\n");
}
else if (pulse > 35 && pulse < 50){
printf("* Your pulse rate is lower than normal.\n");
printf("* However, it is typical for athletic people.\n");
}
else if (pulse >= 50 && pulse <=90){
printf("* Your pulse rate is normal.\n");
}
else if (pulse > 90 && pulse <=100){
score++;
printf("* Your pulse rate is reaching risk territory.\n");
printf("* You may be experiencing tachycardia.\n");
}
else if (pulse > 100){
score++;
printf("* Your pulse rate is extremely high.\n");
printf("* You're experiencing tachycardia.\n");
}
else printf("* An error has occured. Invalid input! Try again.\n");
//Respiration rate
printf("> Respiration Rate:\n");
if (respiration < 10){
score++;
printf("* Your breathing rate is below normal.\n");
printf("* You're experiencing hypoventilation.\n");
}
else if (respiration >= 10 && respiration <=20){
printf("* Your breathing rate is normal.\n");
}
else if (respiration > 20){
score++;
printf("* Your breathing rate is above normal.\n");
printf("* You're hyperventilating.\n");
}
else printf("* An error has occured. Invalid input! Try again.\n");
//Blood Pressure
printf("> Blood Pressure:\n");
if (upperbp <= 90 && lowerbp <= 60){
score++;
printf("* Your blood pressure is low.\n");
printf("* You are experiencing hypotension.\n");
}
else if (upperbp < 120 && lowerbp < 80)
{
printf("* Your blood pressure is normal.\n");
}
else if (upperbp <= 129 && lowerbp < 80)
{
score++;
printf("* Your blood pressure is elevated.\n");
}
else if (upperbp <= 139 && lowerbp <= 89)
{
score++;
printf("* Your blood pressure is high.\n");
printf("* Level: High Blood Pressure (Stage 1)\n");
}
else if (upperbp >= 140 && lowerbp >= 90)
{
score++;
printf("* Your blood pressure is alarmingly high.\n");
printf("* Level: High Blood Pressure (Stage 2)\n");
}
else if (upperbp > 180 && lowerbp <= 150)
{
score++;
printf("* Your blood pressure is extremely high.\n");
printf("* You are experiencing a hypertensive crisis.\n");
}
else printf("* An error has occured. Invalid input! Try again.\n");
printf("----------------------------------------------\n");
printf("# Abnormalities found: %d\n" ,score);
printf("----------------------------------------------\n");
printf("\t\tOptions: \n");
printf("\t1. Restart Program\n");
printf("\t2. End Program\n");
printf("----------------------------------------------\n");
printf("> %s, enter the number of your choice: " ,name);
scanf("%d" ,&opt2);
printf("----------------------------------------------\n");
switch(opt2){
case 1:
printf("\t\tRestarting Program...\n" ,name);
break;
case 2:
printf("Thank you for using Rukawaaaaa, %s!" ,name);
break;
default:
printf("An error has occured. Invalid input! Try again.\n");
}
break;
//Legend
case 6:
printf("\t\tLegend:\n");
printf("Temperature\t Readings\n");
printf("<36.1 \t Hypothermia\n");
printf("36.1-37.2 \t Normal Temperature\n");
printf("37.2-40 Febrile Temperature\n");
printf(">40 Hyperthermia\n");
printf("----------------------------------------------\n");
printf("Pulse Rate\t\tReadings\n");
printf("<35 \t Bradycardia\n");
printf("35-49 \t Normal for Athletes\n");
printf("50-90 \t Normal Pulse Rate\n");
printf("91-100 \t\t Risk Territory\n");
printf(">100 \t Tachycardia\n");
printf("----------------------------------------------\n");
printf("Respiration Rate \tReadings\n");
printf("<10 \t Hypoventilation\n");
printf("10-20 \t Normal Breathing Rate\n");
printf(">20 \t Hyperventilation\n");
printf("----------------------------------------------\n");
printf("Blood Pressure\t\tReadings\n");
printf("0-90 / 0-60 Hypotension\n");
printf("<120 / <80 \t Normal Blood Pressure\n");
printf("120-129 / <80\t Elevated Blood Pressure\n");
printf("130-139 / 80-89\t\tHigh Blood Pressure (Stage 1)\n");
printf(">140 / >90\t High Blood Pressure (Stage 2)\n");
printf(">180 / >120\t Hypertensive Crisis\n");
printf("----------------------------------------------\n");
printf("\t\tOptions: \n");
printf("\t1. Restart Program\n");
printf("\t2. End Program\n");
printf("----------------------------------------------\n");
printf("> %s, enter the number of your choice: " ,name);
scanf("%d" ,&opt2);
printf("----------------------------------------------\n");
switch(opt2){
case 1:
printf("\t Restarting Program...\n" ,name);
break;
case 2:
printf("Thank you for using Rukawaaaaa, %s!" ,name);
break;
default:
printf("An error has occured. Invalid input! Try again.\n");
}
break;
default: printf("An error has occured. Invalid input! Try again.\n");
}
break; //End of switch case 1 for outer switch
case 2:
printf("---------------------------- ------------------\n");
printf("Okay, thank you for considering using Rukawaaaaa.\n");
break;
default:
printf("An error has occured. Invalid input! Try again.");
}
//End of switch case 2 for outer switch
}while(opt2 == 1);
return 0;
}