Write a program in c++ which inputs three numbers and outputs the message Sorted if the numbers are in ascending order, and outputs Not sorted otherwise.
plz i want solve this and thanks :)
hi :)
this is solve!! :D
#include<iostream>
using namespace std;
int main()
{
int numbers[3];
bool ascending = true;
for (int i = 0;i < 3;i++) {
cout<< "Number "<< (i + 1) << ": ";
cin >> numbers[i];
}
for (int i = 1;i < 3;i++)
if (numbers[i] < numbers[i - 1])
ascending = false;
if (ascending == true)
cout<< "Sorted." <<endl;
else
cout<< "Unsorted." <<endl;
return 0;
}