If you tried separating the tokens using a space as the delimiter, an issue that I see is that the path\executable name can itself contain a space. This is usually resolved by surrounding that token with quotes. So as you are parsing the whole string, you'd need to keep track of whether you were in a quote or not. If so, then spaces do not count.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
Supposed I have a text file having the results of the 6/49 lottery in it:
How can I achieve the following output written to a text file with filename, "occurences.txt"?
49 - 2 times
49 paired with 13 - 2 times
I don't have an exact idea but maybe the following pseudocode can help:
void main ()
cout<<"CHARACTER \t\ How many times it appeared"<<endl;
for (number='01'; number<='49'; number++)
cout<<number<<" - \t"<<countNumber(numbercount)<<" times"<<endl;
cout<<number<<" paired with \t"<<number<<" "<<ountNumber(numbercount)<<" times"<<endl;
int countNumbers (int number)
ifstrem.stream; //to open the fileint numbercount;
int count=0; //counter to count occurences
stream.open ("countNumbers.txt"); //this opens the file
You cannot use character types that contain more than one character, like '49'. The first thing you need to do is read all the input, split the items into separate fields and convert the numbers to integers. You can then count the individual values, and the sets just by counting through all the saved numbers. You do not need to count from 1 to 49, since some of those values will not be present.
Last Visit: 31-Dec-99 19:00 Last Update: 25-Jan-21 8:24