U E D R , A S I H C RSS

데블스캠프2006/월요일/연습문제/switch/김준석

~cpp
#include<iostream> 
using namespace std; 

void main(){ 

    int i; 
    char a[5] ={0,}; 
    do{ 
    cout << "점수 입력:";  
    cin >> i; 

    if(i==999) continue; 
    else if(i<0 || i>100){
	                 cout << "잘못 했습니다 다시 해주세요" <<endl;  continue; 
					}

    switch(i/10){ 
    case 10: 
    case 9: a[0] +=1; break; 

    case 8: a[1] +=1; break; 

    case 7: a[2] +=1; break; 

    case 6: a[3] +=1; break; 

    default: a[4] +=1; break; 
    
    } 

    }while(!(i==999)); 

    for(i=0;i<4;i++) 
        printf("%c:%d명\n",'A'+i,a[i]); 
    printf("F:%d명\n",a[4]); 
} 
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-05-27 07:09:19
Processing time 0.0135 sec