PDA

نسخه کامل مشاهده نسخه کامل : کمک برای برنامه نمرات دانشجو



jim_allonce
20-12-2009, 19:20
email: amirmm1369@yahoo.om

با سلام.من برنامه ای نوشتم که نمرات چند دانشجوی یک کلاس را بگیرد و میانگین نمرات و ماکسیمم , مینیمم نمرات کلاس
و همچنین نام بازه ای که بالاترین تعداد نمرات را دارد نمایش دهد.فقط مشکلم این است که این برنامه برای یک درس نوشته شده اما می خواهم عملیات .
روی 2 یا 3 درس اجرا شود.خواهشمندم کمکم کنید....اگه میشه لطف کنین روی همین برنامه
اصلاح کنید ممنونتون میشم.(خواهش میکنم ایمیل بدین) 5 نمره واسم داره...کمککککککککک
amirmm1369@yahoo.com

#include<stdio.h>
#include<conio.h>
#include<fstream.h>
int i,j,s,
int a,b,c,d,
ifstream cin,
ofstream cout,
int min,max,ave,
main()
{
cin.open("file.txt"),
cout.open("result2.txt"),
min=100,
max=-1,
s=0,
i=0,
a=0,
b=0,
c=0,
d=0,
cin>>j,
while(j!=-1)
{
if(j>max)
max=j,
if(j<min)
min=j,
s=s+j,
if( (j>=0) && (j<10) )
d++,
else if( (j>=10) && (j<14) )
c++,
else if( (j>=14) && (j<17) )
b++,
else if( (j>=17) && (j<20) )
a++,
i++,
cin>>j,
}
ave=s/i,
if( (a>=b) && (a>=c) && (a>=d) )
cout<<"bazeye aksare nomarat:A"<<endl,
else if( (b>=a) && (b>=c) && (b>=d) )
cout<<"bazeye aksare nomarat:B"<<endl,
else if( (c>=a) && (c>=b) && (c>=d) )
cout<<"bazeye aksare nomarat:C"<<endl,
else if( (d>=a) && (d>=b) && (d>=c) )
cout<<"bazeye aksare nomarat:D"<<endl,
cout<<"Average is:"<<ave,
cout<<"Min is:"<<min,
cout<<"Max is:"<<max,
return 0,
}