I am a new C++ user with emacs. Our Prof. wanted us to create a prog. which basically write the positive which is entering ascending order.

I can do the ascending order program but he wanted us to make user prompt to enter the number in ascending order. The user also cant enter more then 10 numbers.

Please give me some hint and help me how to compile @ emacs.

Thank you...

Declare an array of size 10. Use loop (for/while/do while) statement to read 10 values into an array.

How to compile?
type following command at the *nix prompt,

g++ -o outsort sort.cpp

Note: g++ to name the executable outsort (emacs)

make user prompt to enter the number in ascending order

Its limited to only positive numbers though. (not tested)

int lastNum = -1;
int newNum = 0;
int numEntered = 0;

while(numEntered != 10)
     cout<<"Enter  numbers in ascending order : ";
     cin >> newNum;
     while(newNum < lastNum)
      cout<<"Enter a number greater than << lastNum<<" : ";
      cin >>  newNum;
 numEntered ++;
  lastNum = newNum;