U E D R , A S I H C RSS

데블스캠프2006/월요일/연습문제/switch/이장길

No older revisions available

No older revisions available



==이장길==
~cpp

#include <iostream.h>


void output(int *n);


int main(void)
{
	int score[10];
	int i;
	int num[10]={0,};

	cout<<"성적 10개를 입력하세요.";

	i=0;
	do{

		cin>>score[i];

		if(score[i]==999){
			break;
		}
		i++;
	}while(i<10);
	
	i=0;
	do{

		switch(score[i]/10){
			
		case 10:
			num[0]++;
			break;
		case 9:
			num[0]++;
			break;
		case 8:
			num[1]++;
			break;
		case 7:
			num[2]++;
			break;
		case 6:
			num[3]++;
			break;
		case 5:
			num[4]++;
			break;
		case 4:
			num[4]++;
			break;
		case 3:
			num[4]++;
			break;
		case 2:
			num[4]++;
			break;
		case 1:
			num[4]++;
			break;
		case 0:
			num[4]++;
			break;

		
			

		}
		i++;
	}while(i<10);

	output(num);
	return 0;
}

void output(int *n)
{
	int i;
	
	for(i=0;i<5;i++)
	cout<<char('A'+i)<<" --> "<<*(n+i)<<endl;
}


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:04
Processing time 0.0191 sec