40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
|
#include <iostream>
|
||
|
#include <vector>
|
||
|
#include "simpleMenu.h"
|
||
|
#include "arrayFunctions.h"
|
||
|
|
||
|
int main() {
|
||
|
std::vector<std::string> menu = {"Reverse Array", "Array Expander", "Array Shifter"};
|
||
|
do {
|
||
|
int selection = simpleMenu(menu);
|
||
|
printf("You selected item number %i\n", selection);
|
||
|
int intArray[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||
|
switch (selection) {
|
||
|
case 0:
|
||
|
printf("Array before reversal: ");
|
||
|
printArray(intArray, 10);
|
||
|
printf("Array after reversal: ");
|
||
|
printArray(reverseArray(intArray, 10), 10);
|
||
|
printf("Press Enter to Continue\n");
|
||
|
getchar();
|
||
|
break;
|
||
|
case 1:
|
||
|
printf("Array before expansion: ");
|
||
|
printArray(intArray, 10);
|
||
|
printf("Array after expansion: ");
|
||
|
printArray(arrayExpander(intArray, 10), 20);
|
||
|
printf("Press Enter to Continue\n");
|
||
|
getchar();
|
||
|
break;
|
||
|
case 2:
|
||
|
printf("Array before shifting: ");
|
||
|
printArray(intArray, 10);
|
||
|
printf("Array after shifting: ");
|
||
|
printArray(elementShifter(intArray, 10), 11);
|
||
|
printf("Press Enter to Continue\n");
|
||
|
getchar();
|
||
|
break;
|
||
|
}
|
||
|
} while (true); // We break out elsewhere
|
||
|
}
|