Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool isSorted(int number[], int SIZE);/* You're defining a prototype here, so no variable names */
- int main()
- {
- cout << " Enter list: ";
- int SIZE;/* only const are ALL_CAPS */
- cin >> SIZE;
- const int A = SIZE;/* Why redefine size as A instead of just using size? */
- int number[A];
- for (int i = 0; i < SIZE; i++)
- {
- cin >> number[i];
- }
- if (isSorted)
- cout << " The list is already sorted \n" << endl;
- else
- cout << " The list is not sorted \n" << endl;
- return 0;
- }
- bool isSorted(int number[], int SIZE)
- {
- for (int i = 0; i < SIZE; i++)
- {
- if (number[i] > number[i + 1])
- return false;
- }
- /* What if it is sorted? Where do you return true in that case? */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement