Answer to Question #265204 in C++ for DANISH

Question #265204

Write a program that ask the users to enter three characters. Then the program should display the


following menu



1. Sort in Ascending order


2. Sort in Descending order



The program should perform sorting of these three characters in ascending or descending order as per the user requirement.


1
Expert's answer
2021-11-13T23:51:44-0500
#include <bits/stdc++.h>


using namespace std;


int arr[3];


int main()
{
  cout <<  "Input three numbers: ";
  cin >> arr[0] >> arr[1] >> arr[2];
  sort(arr, arr+3);
  cout << arr[0] << arr[1] << arr[2];
  cout << endl;
  reverse(arr, arr+3);
  cout << arr[0] << arr[1] << arr[2]; 
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS