Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 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.     // 1. Determinate the the youngest person (minAge).
  20.     minAge=1000;
  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.     }
  28.     cout << "\n Youngest person has " << minAge << " years";
  29.  
  30.     // 2. Determinate the the eldest person (maxAge).
  31.     maxAge=0;
  32.            {
  33.              if (age > maxAge) maxAge=age;
  34.            }
  35.     cout << "\n Eldest person has " << maxAge << " years";
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement