Barnamei ke nomerat daneshjiyan ra daryaft karde
va tedad meghdar arzeshi an ra chap konad
// Barnamei ke nomerat daneshjiyan ra daryaft karde
// va tedad meghdar arzeshi an ra chap konad.
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
void main()
{
textcolor(7);
textbackground(1);
clrscr();
int a,b,c,d,grade,k;
k=a=b=c=d=0;
cout<<"\n\n\tfor end insert '-1'\n";
cout<<"\n\tenter a grade "<<++k<<" : ";
cin>>grade;
if(grade>20 || grade<0 && grade!=-1)
{
cout<<"\a\n\terror!!!\n\tEntert Other Grade..." ;
k--;
getch();
}
while(grade!=-1 )
{
switch (grade)
{
case 20:
case 19:
case 18:
++a;
break;
case 17:
case 16:
case 15:
++b;
break;
case 14:
case 13:
case 12:
++c;
break;
default :
if(0<=grade && grade<=11)
++d;
}//end case
cout<<"\n\n\tenter a grade "<<++k<<" : ";
cin>>grade;
if(grade>20 || grade<0 && grade!=-1)
{
cout<<"\a\n\terror!!!\n\tEntert Other Grade..." ;
k--;
getch();
}
}//end while
clrscr();
cout<<"\n\n\n\tcounter of(18-20): a="<<a<<"\n\n\tcounter of(15-17):b="<<b;
cout<<"\n\n\tcounter of(12-14):c="<<c<<"\n\n\tconter number of belowe 12: d="<<d;
getch();
}
سلام خیلی سایت توپی داری .به همین ترتیب ادامه بده. موفق باشی.
تشکر