Transcribed TextTranscribed Text

Problem 1: Complete the following program which includes a function named palindromeflip that takes a string as input and returns a palindrome (i.e. one thatreads the same front to back as back to front) in a very specific way: append to the original string a copy in reverse order. For example, if the input were “abc” then the returned string would be “abccba”. palindromeflip function uses reverse function that takes a string as input and return a string reversed. #include <iostream> #include <string> using namespace std; // takes as input a string and returns a string reversed string reverse(const string&str); // takes as input a string and returns a palindrome string palindromeflip(string str); int main() { string s; cout << "Enter a string: "; cin >> s; cout << "Palindrome: " << palindromeflip(s) <<endl; return 0; } string palindromeflip(string str) { //your code goes here. } string reverse(const string& str) { //your code goes here. } Expected result Expected result Problem 2: Write a program that inputs a time from the console. The time should be in the format “HH:MM AM” or “HH:MM PM”. Hours may be one or two digits, for example, “1:10 AM” or “11:30 PM”. Your program should include a function that takes a string parameter containing the time. This function should convert the time into a four digit military time based on a 24-hour clock. For example, “1:10 AM” would output “0110 hours”, “11:30 PM” would output “2330 hours”, and “12:15 AM” would output “0015 hours”. The function may either write the time to the console or return a string to be written to the console by the main function. Problem 3: Write a program that will read in a line of text and output the number of words in the line and the number of occurrences of each letter. Define a word to be any string of letters that is delimited at each end by either whitespace, a period, a comma, or the beginning or end of the line. You can assume that the input consists entirely of letters, whitespace, commas and periods. When outputting the number of letters that occur in a line, be sure to count upper- and lowercase versions of a letter as the same letter. Output the letters in alphabetical order and list only those letters that do occur in the input line. Following is an example of sample run. Expected result

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

// Palindromeflip function

string palindromeflip(string str)
// The final and reverse strings are setup
string fs,rs;

// The reverse string is set to call the reverse function

// Attaches the input and reverse string

// Returns the final string
return fs;

// Reverse function
string reverse(const string& str)
// Copying the passed inputer string and the reversed string
string cstr, rstr;

// Copy the input string variable

// Reversing the string
for(int i=0;i<int(cstr.length());i++)
rstr = str[ i ] + rstr;

// Returning the reversed string
return rstr;
$30.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Computer Science - Other Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats