forked from Mohammed-Shoaib/Coding-Problems
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB0039.cpp
More file actions
35 lines (31 loc) · 646 Bytes
/
B0039.cpp
File metadata and controls
35 lines (31 loc) · 646 Bytes
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
// Problem Code: FLOW014
#include <iostream>
using namespace std;
int gradeTheSteel(int hardness, float carbon, int strength) {
bool c1, c2, c3;
c1 = (hardness > 50) ? true : false;
c2 = (carbon < 0.7) ? true : false;
c3 = (strength > 5600) ? true : false;
if(c1 && c2 && c3)
return 10;
else if(c1 && c2)
return 9;
else if(c2 && c3)
return 8;
else if(c1 && c3)
return 7;
else if(c1 || c2 || c3)
return 6;
else
return 5;
}
int main() {
int T, hardness, strength;
float carbon;
cin >> T;
while(T--) {
cin >> hardness >> carbon >> strength;
cout << gradeTheSteel(hardness, carbon, strength) << endl;
}
return 0;
}