Home > Software engineering >  Using MFC to do a text file statistics software automatically
Using MFC to do a text file statistics software automatically

Time:09-26

Can automatic statistics every characters in a text file (including Chinese characters), the number of occurrences of output for each line of the record content: characters, the number of occurrences of, a list of the number of rows, separated by commas,

CodePudding user response:

this do efficiency is not high

CodePudding user response:

Can't, the teacher asked

CodePudding user response:

 
# ifdef WINDOWS
# define int64_t _int64
# endif
Typedef struct tag_CCharStatistic
{
Would be buf [30].//character
Int64_t Amount;//statistics the number of characters in a row
Int64_t nLine;//character lines
} CCharStatistic;

CCharStatistic obj.
//_wfopen file stream operation, fwscanf or read fgetws, or open system calls, read read or c + + iftream flow operation, getline read open the specified file, you read the file information, through every line of every character, every character is deposited in the bank information, an instance obj, and then placed into a vector container
Then according to the characters of the sorting,

Method to tell you, also gives the data structure, the rest of the organization code, it is not difficult, be careful to use Unicode way to write code, because a Chinese characters in the Unicode is treated as a character unit, do not use the way of the ANSI function,

CodePudding user response:

soar reference 3 floor response:
 
# ifdef WINDOWS
# define int64_t _int64
# endif
Typedef struct tag_CCharStatistic
{
Would be buf [30].//character
Int64_t Amount;//statistics the number of characters in a row
Int64_t nLine;//character lines
} CCharStatistic;

CCharStatistic obj.
//_wfopen file stream operation, fwscanf or read fgetws, or open system calls, read read or c + + iftream flow operation, getline read open the specified file, you read the file information, through every line of every character, every character is deposited in the bank information, an instance obj, and then placed into a vector container
Then according to the characters of the sorting,

Method to tell you, also gives the data structure, the rest of the organization code, it is not difficult, be careful to use Unicode way to write code, because a Chinese characters in the Unicode is treated as a character unit, do not use the way of the ANSI function,


We have not learned the language, but thank you

CodePudding user response:

What call Chinese characters?
Ah GBK: 0 xb0 0 xa1, Unicode - 16 LE: 0 x4a 0 x55, Unicode - 16 BE: 0 x55 0 x4a, utf-8 8-0 x95 xE5 0 0 x8a, Big5:... . , Shift - JIS:... . . .

CodePudding user response:

Want to know if you make no, now I also have this job,,,

CodePudding user response:

Do a map, the key for the character, the value for occurrences
Through text, UINT (characters) and 128, for Chinese characters, takes two byte
And then judge whether there is in the map, existence value plus 1, there is no add node
Finally through the output map
Should be the thing you want, the code is scanty
  • Related