|
From: Ronnill D. R. <ron...@ya...> - 2010-09-03 16:53:37
|
can you make me a program.. just a easy one not that complicated one....
PROBLEM 1
Write a program that displays the menu such as the following:
[A] Input integers
[B] Input strings
[C] Exit program
Enter your choice:
If choice A or B is selected, the program prompts the user to input a positive
integer value, say n, which
determines the number of elements (either integers or string) to input. It then
prompts the user to input n
elements and stores them in an array with a maximum size of 100. After the
input, the program displays
a menu that looks like the one below (choices A and B should have the same
menu):
[1] Search an element
[2] Display elements
[3] Insert an element
[4] Delete an element
[5] Edit an element
[6] Sort elements
[7] Back to main menu
What do you want to do?
If option 1 is selected, the user is prompted with the element to be searched.
If the element is found, its
position number (index+1) is displayed (e.g. element is found at position 1).
Otherwise, an error
message is displayed. If there are elements that are the same, all the position
numbers are displayed.
If option 2 is selected, it displays all the elements currently stored in the
array. If option 6 is not yet
selected, the elements are displayed in unsorted order. If option 6 has already
been selected, the
elements are displayed in sorted order.
If option 3 is selected, the user is prompted with the element to be inserted
and the position number to
which the element is inserted. The element is then inserted at the specified
position thereby increasing
the number of elements currently stored in the array.
If option 4 is selected, the user is prompted with the element to be deleted. It
uses the search routine to
search for the element to be deleted. If found, the element is then deleted
which decreases the
number of elements in the array. If not found, an error message is displayed.
If option 5 is selected, the user is prompted with the position number. Using
the search routine, the
program displays the current element stored in the position number specified. It
then prompts the user
for the new element to replace thus replacing the original element stored in the
position number
specified.
If option 6 is selected, it prompts whether the elements are to be sorted in
ascending or descending
order. Given the choice, the elements are then displayed in sorted order using
the display routine.
If option 7 is selected, the program goes back to the main menu.
The program exits only when choice C is selected from the main menu. Every after
routine execution,
the program displays the MAIN MENU.
PROBLEM 2
Write a program that inputs a string. It then counts and displays the number of
characters (including
white spaces), and words in a string.
Sample run:
Input string: My name is Maui!
Characters: 16
Words: 4
PROBLEM 3
Write a program that inputs a string. It then displays the string first with the
words reversed and the
second with the characters reversed in each word.
Sample run:
Input string: My name is Maui!
Maui! is name My
!iuaM si eman yM
PROBLEM 4
Write a program that inputs a string. It then deletes all the white spaces,
punctuations and other special
characters leaving and displaying only the letters and digits.
Sample run:
Input string: My name is Maui! The date today is 02/15/08.
MynameisMauiThedatetodayis021508
plzz.... plz repz as much as possible.. i'm going to need this program this
monday...
|