örnek func c++ - #include...

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

View Full Document Right Arrow Icon
# 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;} {*ch= 'B'; *y=*y+1;} {*ch='C'; *z=*z+1;} 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
{*ch= 'D'; *q=*q+1;} {*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);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

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

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online