임다찬

~cpp
#include <iostream>
using namespace std;
int main(){
	int jumsu; 
	int grade[5]={0,};
	char g='A';

	do{
		cin >> jumsu;
		if(jumsu == 999) continue;
		else if(jumsu > 100 || jumsu < 0) continue;
		switch(jumsu/10){
			case 10:
				++grade[0]; break;
			case 9:
				++grade[0]; break;
			case 8:
				++grade[1]; break;
			case 7:
				++grade[2]; break;
			case 6:
				++grade[3]; break;
			default:
				++grade[4]; break;
		}			
	}while(jumsu != 999);

	for(int i = 0; i < 4; i++){
		cout << (char)(g+i)<< " : " <<grade[i]<<" 명"<<endl;
	}
	cout << "F : " <<grade[4]<<" 명"<<endl;
	
	return 0;
}
Retrieved from http://wiki.zeropage.org/wiki.php/데블스캠프2006/월요일/연습문제/switch/임다찬
last modified 2021-02-07 05:29:04