Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in C++.....Write a program which sorts 5 students by the year of their enrollment in university So if i Input ID Name year of study

in C++.....Write a program which sorts 5 students by the year of their enrollment in university

So if i Input

ID Name year of study

1 Smith Mary 3
2 Jones Sophie 1
3 Williams Mary 4
4 Brown Anne 2
5 Taylor Joana 5

The output should be

ID Name year of study

1 Jones Sophie 1
2 Brown Anne 2
3 Smith Mary 3
4 Williams Mary 4
5 Taylor Joana 5

Use indications given below

-use sort function from STL

-use following pseudocode

struct Node{

int ID;

char name[50];

int year;

};

-use Standard Template Library:

list TheList;

-insert data in TheList ( at the back)

Node el;

el.ID=1;

strcpy(el.name,"name 1");

el.year=1;

lista.push_back(el);

- print elements in the list

for(std::list::iterator it = lista.begin(); it != lista.end(); it++) {

cout << "ID: " << it->ID << " nume: " << it->nume << " an: "<< it->an << endl;

}

- insert data into the list(at the begining, at the end)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions

Question

3. What may be the goal of the team?

Answered: 1 week ago

Question

2. What type of team would you recommend?

Answered: 1 week ago