Computer scienceProgramming languagesC++Introduction to STL (Containers and Algorithms)

Basic data structures of STL

Theory

Vector creation

Report a typo

Create a C++ program that uses a vector to store the ages of students. You have to add three students and ask the user to enter the name and ages every time the program is compiled, look up the age of a student, and display it.

You can use indexing operator inside a loop to set the age of a student.

Sample Input:

Maria // Name of a student
23 // Age of a student
Jucy
28
Albert
29
Albert // Looking up the age of a student 

Sample Input 1:

Maria
23
Jucy
28
Albert
29
Albert

Sample Output 1:

Age of Albert is 29 years

Sample Input 2:

Albert
30
Jucy
29
Maria
24
Maria

Sample Output 2:

Age of Maria is 24 years
Write a program in C++





___

Create a free account to access the full topic