|
|
|
|
|
|
Posted: Tue Mar 02, 2010 1:30 pm
So I took a month off from C++ Programming. This is my major- well, technically video gam programming is my major, its what i do- any ideas would be helpful in this loverly assignment. It's long and obnoxious.
I NEED IDEAS, NOT ANSWERS!!!!
Write a C++ program that repeatedly asks for and gets a string from user and presents the following menu of operations on the string until user chooses to exit:
1. Search for a character in the string
2. Change a character within the string
3. Display the first n characters of the string
4. Display the last n character of the string
5. Display all characters that lie between two given indices
6. Null the string
7. Display the first and last characters
8. Exit
Each of the above tasks except for the option to exit must be performed by a function written for the given task.
The function for menu item 1 takes the string and a character and returns either the index within the string of the first occurrence of the character or -1 if it could not be found. The function must also report, through a parameter, how many times it was found. The Main function must print the location found or that it was not found along with how many times it was found.
The second function takes a string, an integer for the position of the character to be changed and a character and changes the character located at the given position in the string to the given character. It returns false if the given index is outside the bounds of the string and true otherwise.
The third function takes a string and an integer n and displays the first n characters of the string. It returns false if the specified position is outside the bounds of the string.
The fourth function takes a string and an integer n and displays the last n characters of the string. It returns false if the specified position is outside the bounds of the string.
The fifth function takes a string and two integers and displays all the characters that lie between the two indices, inclusive. It returns false if the specified positions are outside the bounds of the string.
The sixth function takes a string and nulls the string meaning it makes it a 0-length string. If it already has 0 length, it must display a message saying that.
The seventh function takes a string and reports back the first and last characters of the string.
Upload both exe and cpp files using the Browse and Upload buttons below. (The cpp file is in the folder that has the name you gave the project. The exe file is located in a folder called Debug. There are two Debug folders.) Once you see both files uploaded, click Finish to submit. Make sure you don't click Finish before uploading the files as this will submit a blank page and won't let you resubmit.
|
 |
 |
|
|
|
|
|
|
|
|
Posted: Tue Mar 02, 2010 1:52 pm
Mostly, my problem is (and sadly, always has been) is that I don't know how to integrate the programs together.
For instance, I don't understand how I'm supposed to make it go from main to whatever comes next. What I really need to know is how to make the choice from the menu happen. Like, ok, they said 1. Now what? I gotta somehow type that I want that function to happen. But I don't understand how to... gar, there's a word for this. To go from Main to that other function, and back again. How do I tell it to do what the user inputted? WHY CAN'T I JUST TELL MY COMPUTER TO DO SOMETHING AND THEN IT DOES IT?!?!?!?!?!?! T crying T
|
 |
 |
|
|
|
|
|
|
|
|
|
|
Posted: Thu Apr 29, 2010 7:59 am
What school you going to?
|
 |
 |
|
|
|
|
|
|
 |
|
|
|
|
|