SUBMISSION+CALEB

Enter your submission for both Challenges here. Make sure you label your solutions clearly.

__**Challenge 1**__ code format="cpp" /* Caleb Foo 3S113 E-learning 26May Challenge 1
 * 1) include
 * 1) include

using namespace std;

int main {

int choice, repeat = 0, Tables[10]={88,44,-21,0,23,8,-34}, Tableslength=7, Tmax=Tables[0], Tmin=Tables[0]; int irepeat, numRepeat=0; float Ttotal=0;

while(repeat == 0) {       cout << "Tables[" << Tableslength << "] = {"; for(int i=0; i> choice;

switch(choice) {           case 1: for(int i=0; iTables[i]){ Tmin = Tables[i]; }               }                cout << "\nThe min is " << Tmin << ".\n\n\n\n"; break; case 3: for(int i=0; i> irepeat; for(int i=0; i<Tableslength; i++){ if(Tables[i] == irepeat){ numRepeat++; }               }                cout << "\nThe number '" << irepeat << "' repeated " << numRepeat << " time(s).\n\n\n\n"; break; case 5: cout << "\nThe reverse order is {"; for(int i=1; i<=Tableslength; i++){ cout << Tables[Tableslength-i]; if (i != Tableslength){ cout << ","; }               }

cout << "}.\n\n\n\n"; break; default: cout << "\nInvalid selection, please try again.\n\n\n\n"; }   }

return 0;

} code

code format="cpp" /* Caleb Foo 3S113 E-learning 26May Challenge 2
 * __Challenge 2__**
 * 1) include
 * 1) include

using namespace std;

int main {	char Allocations[5]={'z','v','E','a','b'},temp; int i, aLength=sizeof(Allocations), repeatSwap=1;

cout << "Original        Allocations[5]={"; for(i=0;iAllocations[i+1]){ temp = Allocations[i+1];             //Swapping Allocations[i+1] = Allocations[i];   // Allocations[i] = temp;               // repeatSwap = 1;                      //Swapping has occurred }		}	}while(repeatSwap == 1); //After breaking loop, Allocations should be in correct accending order already

cout << "\nAfter swapping  Allocations[5]={"; for(i=0;i<aLength;i++){ cout << Allocations[i]; if(i<aLength-1){ cout <<","; }	}	cout << "}";

cin.get; return 0; } code