Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     unsigned int age;
  8.     unsigned int nr_teammate, i;
  9.     int minAge, maxAge;
  10.     int ageDifference;
  11.     float middleAge;
  12.     int value, low, equal, high;
  13.     cout << "\n Project Nr 1, elaborated by Adamciuc Ivan \n" ;
  14.     //reading data
  15.  
  16.     cout << "\n Introduce number of team-mates: \n\t";
  17.     cin >> nr_teammate;
  18.  
  19.     minAge=1000;
  20.     maxAge=0;
  21.     cout << "\n Introduce " << nr_teammate << " ages \n";
  22.     for (i=1; i<=nr_teammate; i++)
  23.     {
  24.         cout << "\t";
  25.         cin >> age;
  26.         if (age < minAge) minAge=age;
  27.         if (age > maxAge) maxAge=age;
  28.     }
  29.     // 1. Determinate the the youngest person (minAge).
  30.     cout << "\n Youngest person has " << minAge << " years";
  31.  
  32.     // 2. Determinate the the eldest person (maxAge).
  33.     cout << "\n Eldest person has " << maxAge << " years";
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement