#include <iostream>
int main(void)
{
int studentValue;
std::cout << " 성적을 분류할 학생의 성적을 입력하세요 : ";
std::cin >> studentValue;
if (studentValue > 90) {
std::cout << "학생의 성적 : A";
}
else if (studentValue > 80) {
std::cout << "학생의 성적 : B";
}
else if (studentValue > 70) {
std::cout << "학생의 성적 : C";
}
else if (studentValue > 60) {
std::cout << "학생의 성적 : D";
}
else if (studentValue > 50) {
std::cout << "학생의 성적 : F";
}
}
if를 이용한 노가다로 쉽게 분류가 가능한 1명의 학생의 성적을 분류하기 위한 코드.
'컴퓨터 공학 일지 > 알고리즘' 카테고리의 다른 글
그리디 알고리즘 - 거스름돈 계산하기 - C++ (0) | 2019.12.15 |
---|---|
구구단 출력하기 [C++] (0) | 2019.12.08 |