SHARE
TWEET

Untitled

a guest Dec 9th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. #include <iostream>
  4. #include <fstream>
  5. using namespace std;
  6.  
  7. int main() {
  8.     ifstream mark;
  9.     int const size=5;
  10.     int q1[size],q2[size],q3[size],c1=0,c2=0,c3=0;
  11.  
  12.     float av1=0,av2=0,av3=0;
  13.     int KCSTID[size],i=0;
  14.     mark.open("marks.txt");
  15.     if(!mark){
  16.         cout<<"Fille openin failure!";
  17.  
  18.     }
  19.     else{
  20.         cout<<"\n\t\t Kuwait College of Scince and Technnology , Doha Kuwait"<<endl;
  21.         cout<<"\n --------------------";
  22.         cout<<"\n KCSTID \t Quiz 1 \t Quiz 2 \t Quiz 3 ";
  23.         cout<<"\n --------------------";
  24.  
  25.         while(mark >>KCSTID[i]>>q1[i]>>q2[i]>>q3[i]){
  26.             av1=av1+q1[i];
  27.             av2=av2+q2[i];
  28.             av2=av3+q3[i];
  29.             i++;
  30.  
  31.         }
  32.         av1=av1/size;
  33.         av2=av2/size;
  34.         av2=av3/size;
  35.  
  36.         for(int i=0;i<size;i++){
  37.             if(q1[i]>av1)
  38.                 c1++;
  39.             if(q2[i]>av2)
  40.                             c2++;
  41.             if(q3[i]>av3)
  42.                             c1++;
  43.  
  44.         }}
  45.     cout<<"\n \t Quiz 1 \t Quiz 2 \t Quiz 3 ";
  46.     cout<<"\n Class Average : "<<av1<<"\t"<<av2<<"\t"<<av3;
  47.     cout<<"\n Count : "<<c1<<"\t"<<c2<<"\t"<<c3;
  48.  
  49.     mark.close();
  50.  
  51.  
  52.     return 0;
  53. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top