Hi there people i have a problem i have been asked to Accept characters from a data file. Convert all the characters to upper case,Save the characters to a new data file which i have done. But for some reason im stuck on trying to get the following to work:
Detect a word
Detect a position of the word
Detect a number of occurrences of the word
couldnt find anything on the internet so i havent got anywhere lol
i may be having an off day so if some one could please explain on how to do this without telling me or maybe some hints and il try and do it my self thanks
here is the code for the 1st part just incase
#include <stdafx.h>
#include <ctype.h>
#include <cstdio>
int _tmain(int argc, _TCHAR* argv[])
{
int ch;
int user;
FILE *pt;
FILE *upper;
pt = fopen( "portfolio2.txt", "r" );
upper = fopen( "upper.txt", "w" );
printf("Do You Want To Convert Characters To Uppercase \nPlease Enter 1 For Yes 0 For No\n");
scanf("%d",&user);
if (user == 1)
{
ch = getc(pt);
while(ch != EOF)
{
ch = toupper(ch);
putc(ch, upper);
ch = getc(pt);
}
printf("Converted Please Check The upper.txt\n");
}
fclose(pt);
fclose(upper);
return 0;
}