Hello im kinda stuck with my program atm... I would really like some help :).
Write a program that performs the following steps. You do not need to use functions in this exercise.
1. Ask the user to type a sequence of 10 integers and then store the values in an array, by the same order as they were entered by the user.
2. If the user entered a sequence of values not sorted then display the message “Sequenceis NOT sorted”.
3. If the user entered a sequence of values sorted increasingly then display the user sequence by decreasing order.
4. If the user entered a sequence of values sorted decreasingly then display the user sequence by increasing order.
Some examples are given below.
Example 1
Enter ten integers: 1 2 3 4 5 6 7 8 9 10
Sequence decreasingly sorted: 10 9 8 7 6 5 4 3 2 1
Example2
Enter ten integers:10 1 1 -2 -3 -4 -5 -6 -7 -7
Sequence increasingly sorted:-7 -7 -6 -5 -4 -3 -2 1 1 10
Example3
Enter ten integers:2 2 2 2 2 2 2 2 2 2
Sequence increasingly sorted:2 2 2 2 2 2 2 2 2 2
Example4
Enter ten integers:1 2 6 3 8 10 -3 0 0 8
Sequence is NOT sorted
My code so far.
Code
#include <iostream>
#include <iomanip>
#include <cmath>
#include <stdio.h>
using namespace std;
int main()
{
int const SIZE =10;
double num[SIZE];
cout << "Enter ten integers: ";
for (int i =0; i <SIZE; i++)
cin >> num[i];
cout << endl;
for(int i =0; i <SIZE; i++)
{
cout << num[i] << setw(3);
}
return 0;
}