Hello,
How can I do this :
Modify the program and use the strtok function to count the number of words in the entire book “Robinson Crusoe”.
I have already store the book in the file (defoe-robinson-103.txt),
Here is the code:
#include#include#define MAX 4000int main(void){int count = 0;FILE* bkPtr;char buffer[MAX];fopen_s(&bkPtr, "defoe-robinson-103.txt", "r");if (bkPtr == NULL){puts("cannot open the file");}else{while (fgets(buffer, MAX, bkPtr)){puts(buffer);}fclose(bkPtr);}}
#define MAX 4000int main(void){int count = 0;FILE* bkPtr;char buffer[MAX];fopen_s(&bkPtr, "defoe-robinson-103.txt", "r");if (bkPtr == NULL){puts("cannot open the file");
}else{while (fgets(buffer, MAX, bkPtr)){puts(buffer);}fclose(bkPtr);}
}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here