answersLogoWhite

0


Best Answer

#include<iostream>

#include<vector>

#include<string>

#include<algorithm>

int main()

{

std::vector<std::string> str_array = { "John", "Bill", "Alan", "Craig"};

std::sort (arr.begin(), arr.end());

}

User Avatar

Wiki User

9y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

6y ago

#include<iostream>

#include<string>

#include<vector>

int main () {

std::cout << "Enter a name: ";

std:string input {};

std::cin >> input;

std::vector<char> v {};

for (size_t i=0; i<input.size(); ++i) v.push_back (input.at(i));

std::sort (v.begin(), v.end());

std::cout << "Sorted name: "; for (size_t i=0; i<input.size(); ++i) std::cout << v.at(i);

std::cout << std::endl;

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a c plus plus program to sort the names in asecending order using array of objects?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How can write a c program to store students record in a file?

Write a console based C++ program that reads student information from a text file, build an array of objects of type class StudentInfo,


How do you write a C Program to fill up an Integer Array?

Reference:cprogramming-bd.com/c_page1.aspx# array programming


Could you Write a program for 8086 microprocessor that displays on the monitor the average of 2 numbers from an array?

How to write a program for mouse in microprocessor?


How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.


What is the Java program for sorting an array?

Java has a very efficient built in implementation of quick sort. You can use it on any array of primitives or Comparable Objects by invoking Arrays.sort(&lt;array&gt;) See related link.


How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


How do you write a program in C to find and display the sum of each row and column of a 2 dimensional array of type float?

array type


Write a c program to find the maximum value of 25 element in an array?

int findMax(int *array) { int max = array[0]; for(int i = 1; i &lt; array.length(); i++) { if(array[i] &gt; max) max = array[i] } return max; }


Write a c program to find the maximum of two numbers and print out with its position?

maxValue = function (array) {mxm = array[0];for (i=0; i&lt;array.length; i++) {if (array[i]&gt;mxm) {mxm = array[i];}}return mxm;}; i don't know


What is an arrangement of objects into equal rows and columns?

Tabulated form of objects


Write a c program to reverse an array without using another array?

public static int[] reverseArray(int[] array) { int i = 0, j = array.length - 1; for (i = 0; i &lt; array.length / 2; i++, j--) { int temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; }


Write a program to substrate two matrixs in two dimension array?

You need to specify the language in which you want the subtraction of the two matrix in two dimension array written.