Lab 5

String Functions

Announcements

Pre-lab reading material

Go through the link here to learn about some common string functions. 

Steps You Need to Do

***Download the file given at the bottom of the page and start editing.***

Complete execution of the program should result in the following output. User input is marked in bold. 

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

all generalizations are false

Length of your input is: 29

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:

are

Word [are] is found.

First word in the input string is all.

Second word in the input string is generalizations.

Third word in the input string is are.

Stage 0 (0.5 points)

----------------

- Prompt the user for a string.

- Display the length of the string.

- You can assume the max length of input string (char array) is 81.

Sample Output

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

all generalizations are false

The length of your input is : 29 

Stage 1 (0.5 points)

-----------------

- Prompt the user for a character.

- Search for the character in the string (string entered by user in stage 1).

Sample output:

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

z

Character [z] is found

Stage 2 : (1 point)

-----------------

- Prompt the user for a new word.

- Search the string (string entered by user in stage 0) for the word.

Sample output:

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

are

Word [are] is found

Stage 3 : Extra Credit (1 point)

-----------------

- Separate out the first three words.

- Store them in given char arrays namely first, second and third.

Sample output:

First word in the input string is all.

Second word in the input string is generalizations. 

Third word in the input string is are.