Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a complete program that prompts the user (in any manner of your choice - S

ID: 3574859 • Letter: W

Question

Write a complete program that prompts the user (in any manner of your choice - Scanner, command line args, J File Chooser) for two filenames. The program reads the input file line-by-line and writes to the output file the same lines preceded by the line number and number of words in the line. Be sine to catch the appropriate exceptions and to close the files. Examples of possible input and output files are show below: Alternate: For 9 out of 15 marks you can file copy program where the output file is simply a line-by-line copy of the input file.

Explanation / Answer

#include #include void main() { char s[200]; int count = 0, i; printf("enter the string "); scanf("%[^ ]s", s); for (i = 0;s[i] != '';i++) { if (s[i] == ' ') count++; } printf("number of words in given string are: %d ", count + 1); }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote