I need any help I can get on this one! Any advice ismuch appreciated. The code m
ID: 3612713 • Letter: I
Question
I need any help I can get on this one! Any advice ismuch appreciated. The code must be in .c Write a program that inputs several lines of text and usesstrtok to count the total number of words. Assume that thewords are sparated by either spaces or newline characters. I need any help I can get on this one! Any advice ismuch appreciated. The code must be in .c Write a program that inputs several lines of text and usesstrtok to count the total number of words. Assume that thewords are sparated by either spaces or newline characters.Explanation / Answer
please rate - thanks sample run this is a program that counts the number of words ^Z There were 10 words notice the use of ctrl Z when done with input #include #include #include int main() {int i,j,count=0;; char str[80]; char *in; FILE *file; char * pch; in=gets(str); while(in!=NULL) {pch = strtok (str," "); while (pch != NULL) { count++; pch = strtok (NULL, " "); } in=gets(str); } printf("There were %d words ",count); getch(); return 0; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.