All of the work in this project is my own! I have not left copies of my code in public folders on university computers. I have not given any of this project to others. I will not give any portion of this project to others taking this class. I realize that the penalty for turning in work that is not my own can range from an "F" in the class to dismissal from Trinity University.
Print Title ______________________________________ Time Required = ______.____ Hrs.
Signature ______________________________________ (pledged)
1] Copy start.c to ???-HW5.c Copy (replace ??? with your first name. - I would use Tom-HW5.c)

1] Documentation your main program (replace the name and date appropriately!)



1]
I recommend that you write one function at a time. Test
it! Once it works well, move on to the next function. You can do this by
un-commenting out one small portion of the main program at a time until the
whole main program is un-commented.
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// LowChar //
// //
// Purpose : Explicitly return the lower case character. Character T //
// becomes t & character X becomes x. Only capital letters are //
// changed; all others are simply returned as is. //
// //
// Written By : Thomas E. Hicks Environment : Linux //
// Date ......: xx/xx/xxxx Compiler ...: gcc //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// UpChar //
// //
// Purpose : Explicitly return the upper case character. Character t //
// becomes T & character x becomes X. Only lower letters are //
// changed; all others are simply returned as is. //
// //
// Written By : Thomas E. Hicks Environment : Linux //
// Date ......: xx/xx/xxxx Compiler ...: gcc //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// LowerStr //
// //
// Purpose : Convert String[] to all lower case characters. //
// LowerStr("tOm HiCKs") becomes string tom hicks //
// //
// Written By : Thomas E. Hicks Environment : Linux //
// Date ......: xx/xx/xxxx Compiler ...: gcc //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// UpperStr //
// //
// Purpose : Convert String[] to all upper case characters. //
// UpperStr("tOm HiCKs") becomes string TOM HICKS //
// //
// Written By : Thomas E. Hicks Environment : Linux //
// Date ......: xx/xx/xxxx Compiler ...: gcc //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// StdinFlush //
// //
// Purpose : This utility, to be used immediately after every scanf, is used to //
// flush the standard input buffer. //
// //
// Written By : Thomas E. Hicks Environment : Linux //
// Date ......: xx/xx/xxxx Compiler ...: gcc //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// GetString //
// //
// Purpose : (1) If Clear is true, then clear the terminal window; otherwise //
// don't. //
// //
// (2) Print the prompt; to the right of the prompt add //
// [Hit ENTER Key To Exit!]. GetString("Enter Name", Name, 50,false) //
// the user should see ==> Enter Name [Hit ENTER Key To Exit!] : //
// //
// (3) Declare char TempString[200]; //
// It is now time for the user to respond to the prompt. Use gets //
// to fill the string container called TempString. //
// //
// (4) If the USER simply hits the ENTER key, return false. //
// //
// (5) Check to see if the user entered too many characters (more //
// than 29 for the example above) //
// "The info you have just entered is too big!\n" //
// "Your answer may be no more than 49 characters in length\n" //
// "Please Try Again!\n\n\n" //
// Return to step (2) and repeat all of the steps. //
// //
// (6) Transfer the contents of TempString to String (after all //
// you now know that it will fit) //
// //
// (7) Return true. //
// //
// //
// Written By : Thomas E. Hicks Environment : Linux //
// Date ......: xx/xx/xxxx Compiler ...: gcc //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
|
int main (int argc, char * argv[])
{
char
Ch,
Name[50],
State[7];
puts ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
puts ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
puts ("++ Utility Functions HW5 ++");
puts ("++ ++");
puts ("++ Writen By ++");
puts ("++ ???????????????????? ++");
puts ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
puts ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
puts ("\n======================== Start Of Main ========================\n");
/*
Ch = UpChar('A');
printf ("UpChar(A) = %c\n", Ch);
printf ("UpChar(a) = %c\n", UpChar('a'));
printf ("UpChar(z) = %c\n", UpChar('z'));
printf ("UpChar(t) = %c\n", UpChar('t'));
printf ("UpChar(1) = %c\n\n", UpChar('1'));
Ch = LowChar('b');
printf ("LowChar(b) = %c\n", Ch);
printf ("LowChar(A) = %c\n", LowChar('A'));
printf ("LowChar(Z) = %c\n", LowChar('Z'));
printf ("LowChar(T) = %c\n", LowChar('T'));
printf ("LowChar(1) = %c\n\n", LowChar('1'));
strcpy(Name, "tOm HiCKs");
UpperStr(Name);
printf ("UpperStr(tOm HiCKs) = %s\n", Name);
strcpy(Name, "comPUteR ScIENce roCKS!");
UpperStr(Name);
printf ("UpperStr(comPUteR ScIENce roCKS!) = %s\n", Name);
strcpy(Name, "ab [1234567890[]{}.,><?/!@#$%^&*()_+=]");
UpperStr(Name);
printf ("UpperStr(ab [1234567890[]{}.,><?/!@#$%^&*()_+=]) = %s\n\n", Name);
strcpy(Name, "tOm HiCKs");
LowerStr(Name);
printf ("LowerStr(tOm HiCKs) = %s\n", Name);
strcpy(Name, "comPUteR ScIENce roCKS!");
LowerStr(Name);
printf ("LowerStr(comPUteR ScIENce roCKS!) = %s\n", Name);
strcpy(Name, "ab [1234567890[]{}.,><?/!@#$%^&*()_+=]");
LowerStr(Name);
printf ("LowerStr(ab [1234567890[]{}.,><?/!@#$%^&*()_+=]) = %s\n\n", Name);
Pause();
if (GetString("Enter Name", Name, 50, true))
printf ("You Entered The Following Name: [%s]\n\n", Name);
else
puts ("You Chose Not To Provide A Name!");
Pause();
puts ("\n========================= End Of Main =========================\n");
if (GetString("Enter State", State, 7, true))
printf ("You Entered The Following State: [%s]\n\n", State);
else
puts ("You Chose Not To Provide A State!");
Pause();
*/
puts ("\n========================= End Of Main =========================\n");
return (0);
}
|
1] I recommend that you write one function at a time. Test it! Once it works well, move on to the next function. You can do this by un-commenting out one small portion of the main program at a time until the whole main program is un-commented.
1] Output should be: (make sure that you change the names to yours and the dates throughout!) Test your program well!



1] Copy file tom-hw5.c to
/users/thicks/hw1320/hw51] Signed copy of page 1 of this Lab.
2] Printed copy of the source code.
3] Nothing will be graded until you copy the file into the /users/thicks/hw1320 directory.
4] Nothing will be graded until this lab form is submitted. Staple the pages. Fold the lab Horizontally (like a hot dog) and write your name nice and large on the outside. Place it on the professor desk before the beginning of lecture on the day it is due. All assignments are due the next class period unless otherwise designated on the schedule page.