I have been working on this problem so much, I have started to think in Binary.
what I am supposed to do is put User defined numbers in acending order.
Here is what I tried.
(please dont laugh)
#include <iostream> #include <iomanip> #include <vector> using namespace std; void testSort(int [], int); void testShow(int [], int); int main() { int count=0; int testNum=0; const int SIZE=50; vector<int> test(SIZE); int Avg1=0; double Avg2=0; cout <<"how many tests will you be entering? "; cin >> testNum; for (count=0; count < testNum; count++) { cout << "enter score for test "<< count+1<<" : "; cin >> test[count]; Avg1+=test[count]; } Avg2=static_cast<int> (Avg1)/testNum; testSort(test, SIZE); //this is to show the grades in acending order for (int count = 0; count < testNum; count { cout<< test[count] << endl; } cout << "your average score is: " << Avg2<<endl; system("pause"); return 0; } void testSort(int test[], int SIZE) { int startScan, minIndex, minValue; for (startScan = 0;startScan < (SIZE-1); startScan++) { minIndex = startScan; minValue = test[startScan]; for(int count = startScan +1; count <SIZE; count++) { if (test[count]<minValue) { minValue = test[count]; minIndex = count; } } test[minIndex] = test[startScan]; test[startScan] = minValue; } }
if this looks rediculous, it is because I have tried everything I can think of.
Please help, thank you for your time