Lab 7: Search in string

In this lab, we want you to write a program using C string functions

All function examples can be found in the following two pages:

http://www.cplusplus.com/reference/cstdio/ and http://www.cplusplus.com/reference/cstring/

Especially pay attention to these following functions:

fgetc, fgets, strlen, strchr, strstr, strcpy, strncpy, strcmp

Author:      Hong Wang

Lab:         Thursday 2pm

Program:     Search in string

Please enter a lower-case string (max length = 80):

>all generalizations are all false

Length of your input is: 33

Please enter a character that you want to find in the input string:

>z

Character [z] is found.

Please enter a word that you want to find in the input string:

>all

Word [all] is found.

Word [all] is the first word [all] in the input string.

Example:

Please enter a lower-case string (max length = 80):

>all generalizations are all false

Length of your input is: 33

Example:

Please enter a character that you want to find in the input string:

>z

Character [z] is found.

Please enter a word that you want to find in the input string:

>all

Word [all] is found.

Example:

Word [all] is the first word [all] in the input string.

Notes:

inputStirng[strlen(inputStirng) - 1] = '\0';

Reference links: http://stackoverflow.com/questions/3302255/c-scanf-vs-gets-vs-fgets

while (getchar() != '\n'); 

Reference link: http://stackoverflow.com/questions/7898215/how-to-clear-input-buffer-in-c

Submission: