This program sorts the string entered by user in ascending order. For example, if given string is bcabcz. Then the same string in ascending order is abbccz. Let's have a look at the program:. Here is its answer:. This program works quite good and is very easy to understand. Can you tell me if there is library function to arrange the elements in alphabetical order automatically? Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website.
These cookies do not store any personal information. Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.
Instead of declaring individual variables, such as number0, number1, …, and number99, you declare one array variable such as numbers and use numbers[0], numbers[1], and …, numbers[99] to represent individual variables. A specific element in an array is accessed by an index. All arrays consist of contiguous memory locations. You are required to write a program to sort the name, age, height tuples by ascending order where name is string, age and height are numbers.
The tuples are input by console. The sort criteria is:. If the following tuples are given as input to the program:. Then, the output of the program should be:. In case of input data being supplied to the question, it should be assumed to be a console input.
0コメント