main.cpp //Given a string, take n input from the user for the number of students and then put them in the declared vector. Sort the list in alphabetical order. If two students have same name the...


In c++


main.cpp<br>//Given a string, take n input from the user for the number of<br>students and then put them in the declared vector. Sort the list<br>in alphabetical order. If two students have same name the student<br>with the smaller rollnumber comes first. Assume only one word<br>inputs. Finally input the sorted name and rollnumber on the screen<br>1<br>2<br>//<br>// Example if there are two students named Ali. The one having<br>rollnumber 1 will come before the one having rollnumber 2.<br>3<br>4<br>5<br>//<br>// Part 1 for vector inputing.<br>// Part 2 for sorting and Printing on screen (sorted name with<br>their corresponding rollnumbers)<br>TO-DO<br>7<br>8<br>

Extracted text: main.cpp //Given a string, take n input from the user for the number of students and then put them in the declared vector. Sort the list in alphabetical order. If two students have same name the student with the smaller rollnumber comes first. Assume only one word inputs. Finally input the sorted name and rollnumber on the screen 1 2 // // Example if there are two students named Ali. The one having rollnumber 1 will come before the one having rollnumber 2. 3 4 5 // // Part 1 for vector inputing. // Part 2 for sorting and Printing on screen (sorted name with their corresponding rollnumbers) TO-DO 7 8
10<br>#include <iostream><br>11<br>#include <vector><br>12<br>#include <string><br>13<br>14<br>struct student<br>{<br>int rollnumber;<br>15<br>16<br>std::string name;<br>};<br>17<br>18<br>19<br>20<br>21<br>int main() {<br>22<br>23<br>std::vector<student> list;<br>24<br>25<br>26<br>

Extracted text: 10 #include 11 #include 12 #include 13 14 struct student { int rollnumber; 15 16 std::string name; }; 17 18 19 20 21 int main() { 22 23 std::vector list; 24 25 26

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here