void correctfield( char* fld, char* corrected ) This function must correct a field that is not a
Question:
void correctfield( char* fld, char* corrected )
This function must correct a field that is not a phone number.Doing this in-place is unpleasant, so we copy the field tocorrected while correcting it. The function removes spaces from thebeginning and from the end, replaces repeated spaces by a singlespace, and replaces other whitespace characters (such as TAB) byspaces. You may assume that corrected is large enough to hold theresult.
void correctPhoneNumber( char* number, char* corrected )
This function must correct a phone number. This cannot be donein place, because the number may get longer when it doesn’t startwith + or two zeroes. This function must do the folowing: If thenumber starts with two zeroes, they must be replaced by a single +.If the number does not start with two zeroes, or a +, it mustinsert a + at the beginning. After that, it must copy all digits tothe corrected number, replace letters by digits, and ignoreeverything else. You may assume that corrected is large enough tohold the result. Dealing with the letter codes is a bit unpleasant.We recommend to do it as follows: Use isalpha( ) to recognizeletters, use tolower( ) to make the letter lower case. After that,use a switch statement. If you want you can put it in a separatefunction USAcode( char ). It is a bit unpleasant to type out allcases but any attempt to do it smarter will result in less readablecode.
Please write those functions in C language
Management Accounting Information for Decision-Making and Strategy Execution
ISBN: 978-0137024971
6th Edition
Authors: Anthony A. Atkinson, Robert S. Kaplan, Ella Mae Matsumura, S. Mark Young