Click here to Skip to main content
15,902,636 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: "Got Focus" on a tab page Pin
Ger Hayden4-Nov-05 4:17
Ger Hayden4-Nov-05 4:17 
AnswerRe: "Got Focus" on a tab page Pin
David Crow4-Nov-05 5:08
David Crow4-Nov-05 5:08 
QuestionHelp!!! Pin
friendly man3-Nov-05 21:48
friendly man3-Nov-05 21:48 
Questiontotally confused about UINT_PTR Pin
Saurabh.Garg3-Nov-05 21:46
Saurabh.Garg3-Nov-05 21:46 
AnswerRe: totally confused about UINT_PTR Pin
Johann Gerell3-Nov-05 22:24
Johann Gerell3-Nov-05 22:24 
AnswerRe: totally confused about UINT_PTR Pin
S. Senthil Kumar3-Nov-05 23:22
S. Senthil Kumar3-Nov-05 23:22 
AnswerRe: totally confused about UINT_PTR Pin
qfegd4-Nov-05 3:39
qfegd4-Nov-05 3:39 
QuestionHow to fix the bug of the program?Thank you! Pin
China_Boy3-Nov-05 21:28
China_Boy3-Nov-05 21:28 
#include <vector>
#include <fstream>
#include <iostream>

//英文检索程序
using namespace std;

typedef struct Line
{

int LineNumber; //行数

int Pos; //位置

} LINE;

vector< LINE > Array_Line(200);


//进行字符串的分割

int partition( char * s1 , char * s2 , int pos )
{

int i = pos; //从欲分割的位置开始进行分割

while( s1[i] == ' ' ) //忽略字符串前的所有空格符号
{
i++;
}

if( s1[i] != '\0' ) //判断字符是否已结束
{
int j = 0;

//复制非空格符直到找到下一个空格符
while( s1[i] != '\0' && s1[i] != ' ' )
{
s2[j] = s1[i];
i++;
j++;

}

s2[j] = '\0'; //设置分割字符串之结束字符

return i;

}

return -1;
}

//子字符串的判断

bool Juge( char * strDes , char * strS )
{
int len = strlen( strDes );

for( int i = 0 ; i < len ; i++ )
{
if( strDes[i] != strS[i] )
{
return false;
}
else if( strDes[i] == strS[i] && i == ( len - 1 ) )
{
return true;
}

}

return false;
}

//在一篇文档里找出某字符串的所有行号和个数

int Counter( ifstream file , char * str )
{
int Counter = 0; //设置计数变量起始值

int Number = 0;

int index = 0;

int times = 0;

int position = 0;

char strChar[1024] = {' '};

char partition_string[255] = {' '};

while( !file.eof() )
{

Counter++; //行数加一

file.getline( strChar , 1024 , '\n' ); //读取一行的内容

int tmp = 0;

int pos = 0;

while( ( position = partition( strChar , partition_string , position ) ) != -1 )
{
pos++;

if( Juge( str , partition_string ) )
{
tmp++;

Array_Line[index].LineNumber = Counter;

Array_Line[index].Pos = pos;

Number += tmp;

index++;

}

}

}

return Number; //返回计数值
}

void main()
{
ifstream fin("I:\\Str.dat");

int number = Counter( fin , "cat" );

cout<
AnswerRe: How to fix the bug of the program?Thank you! Pin
kakan3-Nov-05 21:35
professionalkakan3-Nov-05 21:35 
GeneralRe: How to fix the bug of the program?Thank you! Pin
China_Boy3-Nov-05 23:44
China_Boy3-Nov-05 23:44 
GeneralRe: How to fix the bug of the program?Thank you! Pin
toxcct4-Nov-05 2:29
toxcct4-Nov-05 2:29 
GeneralRe: How to fix the bug of the program?Thank you! Pin
ThatsAlok6-Nov-05 21:42
ThatsAlok6-Nov-05 21:42 
Questionhow much does the pre-compile header help to reduce the compile time? Pin
followait3-Nov-05 21:22
followait3-Nov-05 21:22 
AnswerRe: how much does the pre-compile header help to reduce the compile time? Pin
Johann Gerell3-Nov-05 22:24
Johann Gerell3-Nov-05 22:24 
Questionurgent: howto create an instance of unmanaged c++ classes Pin
FreeClimber3-Nov-05 20:56
FreeClimber3-Nov-05 20:56 
AnswerRe: urgent: howto create an instance of unmanaged c++ classes Pin
toxcct3-Nov-05 21:07
toxcct3-Nov-05 21:07 
GeneralRe: urgent: howto create an instance of unmanaged c++ classes Pin
FreeClimber3-Nov-05 21:14
FreeClimber3-Nov-05 21:14 
GeneralRe: urgent: howto create an instance of unmanaged c++ classes Pin
toxcct3-Nov-05 21:15
toxcct3-Nov-05 21:15 
GeneralRe: urgent: howto create an instance of unmanaged c++ classes Pin
FreeClimber3-Nov-05 21:41
FreeClimber3-Nov-05 21:41 
QuestionMultiple desktop Pin
Nishad S3-Nov-05 20:55
Nishad S3-Nov-05 20:55 
QuestionGet width and font of a character ? Pin
kendao3-Nov-05 20:51
kendao3-Nov-05 20:51 
AnswerRe: Get width and font of a character ? Pin
Rob Caldecott3-Nov-05 22:07
Rob Caldecott3-Nov-05 22:07 
AnswerRe: Get width and font of a character ? Pin
ThatsAlok6-Nov-05 21:47
ThatsAlok6-Nov-05 21:47 
QuestionRelease dlls Pin
nripun3-Nov-05 20:28
nripun3-Nov-05 20:28 
AnswerRe: Release dlls Pin
kakan3-Nov-05 21:07
professionalkakan3-Nov-05 21:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.