hamaXD

struct not fuc

Nov 17th, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.96 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main(){
  4. struct student{
  5.     char name[30];
  6.     int eng;
  7.     int math;
  8.     double mean;
  9. }std[3];
  10.  
  11.     int i=0;
  12.     int engmax=-1;
  13.     int engmaxname=0;
  14.     char higheareng[30];
  15.  
  16.     while(i<3){
  17.         printf("enter your name [%d]: ",i+1);
  18.         scanf("%s",&std[i].name);
  19.         printf("enter your point eng [%d]: ",i+1);
  20.         scanf("%d",&std[i].eng);
  21.         printf("enter your point math [%d]: ",i+1);
  22.         scanf("%d",&std[i].math);
  23.    
  24.         printf("student[%d] : name : %s \npoint eng : %d \npoint math : %d\n",i+1,std[i].name,std[i].eng,std[i].math);
  25.        
  26.     i++;
  27.     }
  28.     i=0;
  29.     while (i<1){
  30.         printf("mean : %d \n",(std[i].math+std[i+1].math+std[i+2].math)/3);
  31.         i++;
  32.     }
  33.     i=0;
  34.     while (i<3){
  35.         if(engmax<std[i].eng){
  36.             engmax=std[i].eng;
  37.         //strcpy(higheareng, std[i].name);
  38.             engmaxname=i;
  39.        
  40.     }
  41.     i++;
  42. }
  43.     //printf("name eng max : %s\n",higheareng);
  44.     printf("name eng max : %s\n",std[engmaxname].name);
  45.     printf("point eng max : %d\n",engmax);
  46.    
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment