Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- unsigned int age;
- unsigned int nr_teammate, i;
- int minAge, maxAge;
- int ageDifference;
- float middleAge;
- int value, low, equal, high;
- cout << "\n Project Nr 1, elaborated by Adamciuc Ivan \n" ;
- //reading data
- cout << "\n Introduce number of team-mates: \n\t";
- cin >> nr_teammate;
- minAge=1000;
- maxAge=0;
- cout << "\n Introduce " << nr_teammate << " ages \n";
- for (i=1; i<=nr_teammate; i++)
- {
- cout << "\t";
- cin >> age;
- if (age < minAge) minAge=age;
- if (age > maxAge) maxAge=age;
- }
- // 1. Determinate the the youngest person (minAge).
- cout << "\n Youngest person has " << minAge << " years";
- // 2. Determinate the the eldest person (maxAge).
- cout << "\n Eldest person has " << maxAge << " years";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement