U E D R , A S I H C RSS

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

~cpp
#include<iostream.h>
//#include<stdlib.h>
void main()
{
     int i,j;
	 int t[10];
	 int a=0,b=0,c=0,d=0,f=0;
	 j=0;
	 do
	 {
	    
		 cin>>t[j];
         j++;
	 }while(t[j-1]!=999);
	 
		 for(i=0;i<j;i++)
		 {
		       switch(t[i]/10){
			   case 10: 
				   a++; 
				   break;
			   case 9:
				   a++;
				   break;
			   case 8:
				   b++;
				   break;
			   case 7:
				   c++;
				   break;
			   case 6:
				   d++;
				   break;
               default : 
					if(999==t[i])
						break;
					else
						f++;
				   break;
			   
			   }

		 }
     cout<<"A가 "<<a<<"개 "; 
      cout<<"B가 "<<b<<"개 ";
	   cout<<"C가 "<<c<<"개 ";
	    cout<<"D가 "<<d<<"개 ";
		 cout<<"F가 "<<f<<"개 ";
		 //system("pause");
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-05-27 07:09:19
Processing time 0.0101 sec