four A positive grade of metal is graded in accordance to the following conditions:
(i) Hardness must be increased than 50
(ii) Carbon content material ought to be much less than 0.7
(iii) Tensile energy must be larger than 5600
The grades are as follows:
Grade is 10 if all three conditions are met
Grade is 9 if stipulations (i) and (ii) are met
Grade is eight if prerequisites (ii) and (iii) are met
Grade is 7 if conditions (i) and (iii) are met
Grade is 6 if solely one circumstance is met
Grade is 5 if none of the stipulations are met
Write a program, which will require the person to supply values of hardness, carbon content and tensile power of the metal below consideration and output the grade of the steel.
(i) Hardness must be increased than 50
(ii) Carbon content material ought to be much less than 0.7
(iii) Tensile energy must be larger than 5600
The grades are as follows:
Grade is 10 if all three conditions are met
Grade is 9 if stipulations (i) and (ii) are met
Grade is eight if prerequisites (ii) and (iii) are met
Grade is 7 if conditions (i) and (iii) are met
Grade is 6 if solely one circumstance is met
Grade is 5 if none of the stipulations are met
Write a program, which will require the person to supply values of hardness, carbon content and tensile power of the metal below consideration and output the grade of the steel.
using namespace std;
int main()
{
int hardness ;
float carbon ;
int strength ;
cout << "Enter the value of hardness: " << endl;
cin >> hardness;
cout << "Enter the value of carbon: " << endl;
cin >> carbon;
cout << "Enter the value of Strength: " << endl;
cin >> strength;
if (hardness > 50 && carbon > 0.7 && strength > 5600) {
cout << "Grade is 10: " << endl;
}
else if (hardness > 50 && carbon > 0.7) {
cout << "Grade is 9: " << endl;
}
else if (carbon > 0.7 && strength > 5600) {
cout << "Grade is 8: " << endl;
}
else if (hardness > 50 && strength > 5600) {
cout << "Grade is 7: " << endl;
}
else if (hardness > 50 || carbon > 0.7 || strength > 5600) {
cout << "Grade is 6: " << endl;
}
else {
cout << "Grade is 5: " << endl;
}
return(0);
}
:-(
ReplyDelete