{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

&Atilde;&para;rnek func c++

# &Atilde;&para;rnek func c++ - #include...

This preview shows pages 1–3. Sign up to view the full content.

# include <stdio.h> #define test_1 0.25 #define test_2 0.35 #define test_3 0.40 void f1(double a,double b,double c, double *); void f2(double avg,char *,int *,int *,int *,int *,int *); void f3(int *x,int *y,int *z,int *q,int *p); int main (void) {int x=0,y=0,z=0,q=0,p=0; double a,b,c,avg; char ch; do { printf("\nEnter three test scores:"); scanf("%lf%lf%lf",&a,&b,&c); f1(a,b,c,&avg); printf("your average is:%.2f",avg); f2( avg,&ch,&x,&y,&z,&q,&p); printf(" Your later garede is %c ",ch); } while(a>0 && b>0 && c>0); printf("\n number of A is: %d",x); printf("\n number of B is: %d",y); printf("\n number of C is: %d",z); printf("\n number of D is: %d",q); printf("\n number of F is: %d",p); f3(&x,&y,&z,&q,&p); getchar(); getchar(); getchar(); return 0; } void f1(double a,double b,double c,double *avg) { *avg=((a*test_1)+(b*test_2)+(c*test_3)); } void f2(double avg,char *ch,int *x,int *y,int *z,int *q,int *p){ if(avg<=100 && 90<=avg) {*ch= 'A'; *x=*x+1;} else if(avg<90 && 79<avg) {*ch= 'B'; *y=*y+1;} else if(avg<80 && 69<avg) {*ch='C'; *z=*z+1;} 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
else if(avg<70 && 59<avg) {*ch= 'D'; *q=*q+1;} else if(avg<60 && 0<avg) {*ch= 'F'; *p=*p+1;}} void f3(int *x,int *y,int *z,int *q,int *p){ double class_averge; int students_num; students_num=*x+*y+*z+*q+*p; class_averge=*x*4+*y*3+*z*2+*q*1+*p*0; printf("\n\n\ntotal number of student:%d",students_num); printf("\nclass averege:%.2f",class_averge/students_num);
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}