[Solved] C Program S Common Hear People Start Sentences Opposed Ren Descartes Famous Ending Sentenc Q37289937
C program: It’s so common to hear people start sentences with “Iam” (as opposed to René Descartes, who is famous for ending asentence like that). The Department of Sociology might beinterested in a study of the qualities that people believe theypossess. With the careful use of hidden microphones and NUANCE’sNaturallySpeaking software, it has been possible to obtaintranscripts of several conversations. Let’s see what people thinkof themselves …
Write a C program (6.0%) that:
- Opens a file called MyQualities.txt for writing.
- Repeatedly …
- Reads a sentence from the keyboard (using fgets).
- Checks if the sentences starts with “I am ” (using strstr)
- If it does, then extracts the substring starting at the 5thcharacter, i.e., the substring containing the quality the personbelieves they possess. (using strncpy).
- Concatenates the substring onto a growing string containing allsuch qualities, with a comma separator (using strncat – the growingstring has a maximal length of 1024 characters).
- Appends the substring to the MyQualities.txt file.
- Stops looping when a string containing just a “.” is entered(check using strcmp).
- Outputs the grown string of qualities to the screen.
- Opens the MyQualities.txt file for reading
- Reads and echo the qualities from the file
- Deletes the file
Here’s what a sample run should look like (with the keyboardinput shown in italics) …
Please enter sentences, . to end.Hello everyoneI am very cleverMost people are notI am good looking tooI am really good lookingYou are uglyI am confident.The qualities are very clever, good looking too, really good looking, confident.Confirming the saved qualities … very clever good looking too really good looking confident
Expert Answer
Answer to C program: It’s so common to hear people start sentences with “I am” (as opposed to René Descartes, who is famous for e… . . .
OR

