daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Feb 19th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int mag[]={127,15,138,145,150,160,120,85,100,127};
  7.  
  8.     // átlag magasság
  9.  
  10.     double atlag;
  11.     int i, db=10, sum=0;
  12.  
  13.     for(i=0; i<10; i++)
  14.  
  15.     sum+=mag[i];
  16.  
  17.     atlag=(sum/(double)db);
  18.  
  19.     cout<<"Az osztaly atlag magassaga: "<<atlag<<".\n";
  20.  
  21.     // mennyi tanuló nagyobb mint 150 cm
  22.  
  23.     sum=0, db=0;
  24.  
  25.     for(i=0; i<10; i++)
  26.         if(mag[i]>150)db++;
  27.     cout<<"A 150 cm-nel magassabbak szama: "<<db<<".\n";
  28.  
  29.     // legkisebb tanuló sorszáma
  30.  
  31.     int minindex=0;
  32.     int minertek=mag[0];
  33.  
  34.     for (i=1; i<10; i++)
  35.         if(minertek>mag[i])
  36.         {minindex =i; minertek=mag[i];}
  37.     cout<<"A legkisebb tanulo magassaga "<<minertek<<", sorszama: "<<minindex+1<<".\n";
  38.  
  39. system ("pause");
  40. return 0;
  41. }
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