Monday, January 9, 2012

C++ help on compiling?

The following pseudo code describes how to turn a string containing a 10 digit phone number "such as quote 4155551212" into a more readable string with parenthesis and dashes like this (415)555-1212. take the sub string consistent of the first 3 characters and surround it with "("and")". this is the area code. concatenate the area code the sub string consisting of the next three characters a hyphen and a sub string consisting of the last four characters. this is the formatted number. translate the pseudo code into a c++ program that reads a telephone number into a string variable computes the formatted number and prints it.

No comments:

Post a Comment