Question Description
Functions
Create a program that:
- Declare a string and assign it an arbitrary starting value of your choosing
- Display the current contents of your string, then displays the following menu. If a function returns a string, it should replace the contents of your string, otherwise display the resulting information and leave the string unchanged. Function headers are provided; they should be used as-is in the manner appropriate.
- string getInput()
- MUST use getline (with cin)
- Due to differences in treatment of the n character when we hit enter, cin.ignore may have to be used to fix the input buffer
- Reads user input from cin and stores it in the string being used. Contents will set initial state for the string next loop through program.
- MUST use getline (with cin)
- string printBetween(int a, int b, int step = 1)
- Will return a string containing all numbers between a and b, including a and b, counting up
- E.G. a = 6, b = 3, output = “3456” (don’t use spaces)
- If only two values are provided in the function call, assumes step of 1
- Order is unassumed, but data is displayed counting up
- string nonalnum_removed(string input)
- Returns the string provided as input with all characters that are neither digits nor alphabetic removed
- Will probably involve function isalnum (slides/internet for references)
- If a string, str, has its length changed, any saved results from str.length() calls will be STALE, meaning they no longer reflect our data
- Returns the string provided as input with all characters that are neither digits nor alphabetic removed
- string alphabet_numberified(string input)
- Returns the string provided as input, except with (only) alphabetic characters converted to their character codes within the string
- “11a11” would become “119711”
- Returns the string provided as input, except with (only) alphabetic characters converted to their character codes within the string
- int sumDigits(string digitString)
- Attempts to read each character as a digit, and returns the sum
- Inclusion of non-digit characters should result in a notification (via cout) of the character that could not be summed up
- void saveString(string savedStr)
- Prints the current string’s contents to a file named <your lab filename>.txt
- You can overwrite the previous contents
- Prints the current string’s contents to a file named <your lab filename>.txt
- string getInput()
- Asks the user if they would like to return to step 2, or exit.
Points:
1 – Documentation, readability, format
3 – Proper use of functions
2 – Proper program flow (conditionals, loops, etc)
2 – Filename, Header, and Submission Process
1 – Files
1 – Output testing
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
About Writedemy
We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.
How It Works
To make an Order you only need to click on “Place Order” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Are there Discounts?
All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.