| | |
Sorting int array with stack class
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2005
Posts: 48
Reputation:
Solved Threads: 0
I am trying to figure out how to sort an array with a stack class. The array (pointer) and its length should be passed to the function as parameters so that the original will be sorted. The array created in main() should contain a maximum of 20 integers which should be entered at runtime (input to be ended by the value 0 or automatically when the 20th value is entered). As it it is going through the array, it should place the largest number onto the stack (push). Each time it steps through the array it should find the next smallest number and push it onto the stack. I can assume no two numbers are duplicated in the array. When the stack is popped, all entries should appear in ascending order.
Thank you so much!
Thank you so much!
•
•
Join Date: Aug 2005
Posts: 48
Reputation:
Solved Threads: 0
I am sorry, but I am a newbie regarding C++, is there a more simple method to solving this dilemma?
Thanks
Thanks
![]() |
Similar Threads
- More sorting problems (C++)
- encapsulating an array in a class? (C#)
- Stack conversion (C++)
Other Threads in the C++ Forum
- Previous Thread: Needed some help
- Next Thread: More sorting problems
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream input int integer java lib linux list loop looping loops map math matrix memory multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates text tree url vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






