60 693
Assignments Done
97,9%
Successfully Done
In April 2018

Answer to Question #17431 in C++ for Vipul

Question #17431
Write a program that reads a file, breaks each line into words, strips whitespace and punctuation from the words, and converts them to lowercase
Expert's answer
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<process.h>
#include<ctype.h>
int main()
{
FILE*f;
charname[50],*pch,*pch1;
charch[100];
f=fopen("sample.txt","r");
if(f==NULL)
{
printf("
File Not Found ");
getch();
exit(0);
}
while(fgets(ch,sizeof(ch),f))
{
pch=strtok(ch,",.-");
while(pch!=NULL)
{
printf("%s
",pch);
pch=strtok(NULL,",.-");
}
}
getch();
return0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions