Write your own c plus plus functions for the following problem Print the sort output on the console?

1 answer

Answer

1066316

2026-05-11 10:16

+ Follow

#include<iOStream>

#include<vector>#include<string>

int main()

{

std::vector<std::string> names;

for (int loop=0; loop!=10;)

{

std::cout << ++loop << " enter a name: ";

std::string name;

std::cin >> name;

names.push_back (name);

}

names.sort();

std::cout << "Sorted names:" << std::endl;

for (auto name : names)

std::cout << name << std::endl;

}

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.