can show me how can i get my program to sort an array of elements that are user input and output them
Code:#include <iostream> using namespace std; const int LIMIT = 50; int main() { int MYARRAY[LIMIT]; int value; int i = 0; int print = 0; bool exit = false; while(!exit && i < LIMIT) { cout<<"Enter a number or 999 to quit "; cin>>value; if(value != 999) { MYARRAY[i] = value; i++; } else { exit = true;//if value equals 999 exit the loop } } while(print < i) { cout<<MYARRAY[print]<<endl;//print out the number as long as it is less than i print++; } //"pause" the program cin.ignore(80,'\n'); cin.get(); return 0; }



LinkBack URL
About LinkBacks



.