Project #14006 - C++

Part 1: Palindrome Exercise - C++

 

You will create a program that will determine if an inputted c-string is a palindrome or not.  In main, the user will input a c-string into a character array and send to user-defined functions. 

 

This c-string will be sent to a function that will remove all spaces and punctuation marks from its c-string as well as change any uppercase letters to lowercase.  Use string tokens to eliminate the spaces & punctuation marks.  Make sure you include the \0 NULL as you concatenate the tokens into a c-string.  Then copy back into the original c-string for the pass by reference.

 

Back in main, you will then send the c-string to a function that will see if it is really a palindrome or not.  You will need to create another c-string (that contains the \0) that is filled up as the reverse of the argument c-string.  Then check to see if the c-string is a palindrome and return the boolean result.

 

Back in main, print the c-string (now in all lowercase and without the spaces and punctuation marks) and tell whether it is a palindrome or not.

 

Add sufficient documentation to your file ? name, exercise, at least a 4 line full paragraph about purpose, & at least 5 comments throughout explaining what is going on (what functions do or if a line of code's purpose is not obvious to a novice programmer what that statement does, etc.).  Run the palindrome program with the following data, and check the output results (you can copy and paste them into a blank text file).  Submit the .cpp and the .txt files.

 

Data for possible palindromes:

 

mom

Yankees are number 1

A Santa at NASA.

Did Hannah see bees?  Hannah did!

 

 

Part 2:

C++ Functions & Streams

 

Write a program that will demonstrate some of the C++ Library Functions, Stream Manipulators,  and Selection Control Structures.  The user will be given a menu of four choices.  They can input a 1 for finding Cosines, 2 for finding Logarithms, 3 for converting between Decimal and Hexadecimal, or 4 to Exit the program.  You must use the proper functions and/or stream manipulators to find the answers.

 

1.                  If the user picks the cosine, ask them if they want to find the cosine, arc cosine, or hyperbolic cosine.  Then input a floating point number (in radians) and find and print to three decimal places the proper type of cosine.

 

2.                  If the user picks the logarithms, ask them if they want to find the common logarithm or the natural logarithm.  Then input a floating point number and find and print to three decimal places and a plus or minus sign (for positive or negative numbers) the proper type of logarithm.

 

3.                  If the user picks the conversion, ask them if they want to convert decimal to hexadecimal or hexadecimal to decimal.  If they pick decimal to hexadecimal, ask them if they want to use lowercase or uppercase letters in the printing of the hexadecimal number.  Input the answer as true or false and put the user's answer in a boolean alphabetic variable.  Then input a whole number in the proper base.  Print the inputted number in the user's base and in the converted base.  Use the prefix for the hexadecimal numbers.

 

4.                  If the user picks the exit, use the exit function to end the program.


 

Subject Computer
Due By (Pacific Time) 10/06/2013 04:30 pm
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy