Write a Name_pairs class holding three members (name, age, size) where name is an array of
strings, age is an array of ints, and size is the size of name and age arrays. Write a destructor and
constructor that accepts one input argument which the size. Provide an input operation (method) d .
read_names that reads a series of names. Provide a read_ages operation that prompts the user
for an age for each name. Provide a print operation that prints all the (name[i], age[i]) pairs (one
per line) in the order determined by the name array. Provide a sort operation that sorts the name
array in alphabetical order and reorganizes the age array to match. Create a C++ program and let
user enter 5 names and ages and then use print method to print them. Sort the name array and
print it again.
Notes:
1- Sort the names in name according to the first character only and sort only for the first five
letters. i.e, A, B, C, D, and E.
2- For example, enter the following names: Baraa, Ahmed, Emad, Diaa, and Chloe.
السؤال
حمامه السلام
Write a Name_pairs class holding three members (name, age, size) where name is an array of
strings, age is an array of ints, and size is the size of name and age arrays. Write a destructor and
constructor that accepts one input argument which the size. Provide an input operation (method) d .
read_names that reads a series of names. Provide a read_ages operation that prompts the user
for an age for each name. Provide a print operation that prints all the (name[i], age[i]) pairs (one
per line) in the order determined by the name array. Provide a sort operation that sorts the name
array in alphabetical order and reorganizes the age array to match. Create a C++ program and let
user enter 5 names and ages and then use print method to print them. Sort the name array and
print it again.
Notes:
1- Sort the names in name according to the first character only and sort only for the first five
letters. i.e, A, B, C, D, and E.
2- For example, enter the following names: Baraa, Ahmed, Emad, Diaa, and Chloe.
2 أجوبة على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.