Objectives: Shorting a single dimension array Searching a single dimension array
ID: 3639860 • Letter: O
Question
Objectives: Shorting a single dimension arraySearching a single dimension array
Using two dimensional arrays
Write a menu driven program that offers 7 options to user:
Menu
A. Load array with random numbers
B. Display sorted array
C. Search the array for a given value
Use a while loop with a menu display as the main program control structure.
A. The array is to be declared to hold 100 integers. Prompt and read random number seed from the user and populate the array with numbers <= 500.
B. Sort the array and then Display the array contents. Your display is to be 5 columns of twenty elements each on the screen and the sorted numbers should be displayed top to bottom, left to right.
C. Prompt user to enter the search value, search the array for that value and return the position where the value was found or a message indicating that the value was not found. Use a linear search algorithm. Remember that the array has been searched.
// I got started and created a simple menu.
//I Heres a menu i created, i need help with the functions.
#include <iostream>
using namespace std;
char upcase(char);
void ProgramA(int);
int main()
{
char menuChoice;
bool userNotDone = true;
while (userNotDone)
{
// We can use these to check values of letters
// cout << int('a');
// cout << int('A');
system("cls");
cout << " ******* Menu ******* ";
cout << " A. Choice A ";
cout << " B. Choice B ";
cout << " C. Choice C ";
cout << " X. Choice X ";
cout << " Enter Menu Choice ==> ";
cin >> menuChoice;
switch (upcase(menuChoice))
{
case 'A': cout << "Picked A ";
system ("pause");
break;
case 'B': cout << "Picked B ";
system ("pause");
break;
case 'C': cout << "Picked C ";
system ("pause");
break;
case 'X': cout << "Exit";
userNotDone = false;
break;
default: cout << "Error Message "; // Function Call
}
}
return 0;
}
char upcase(char inComing)
{
if(inComing >= 'a' && inComing <= 'z') // lowercase starts at 65, uppercase at 97
inComing -= 32; // Prefered Syntax -= than -.
return inComing;
}
Explanation / Answer
Please post again with the entire question. It is confusing when only part of the question is here. Rate me and I will answer it.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.