Click here to Skip to main content
15,908,437 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: memset? Pin
CPallini22-Dec-08 21:09
mveCPallini22-Dec-08 21:09 
AnswerRe: memset? Pin
toxcct22-Dec-08 21:37
toxcct22-Dec-08 21:37 
QuestionException in Multithreading.............. Pin
shaina223122-Dec-08 19:52
shaina223122-Dec-08 19:52 
QuestionRe: Exception in Multithreading.............. Pin
CPallini22-Dec-08 21:07
mveCPallini22-Dec-08 21:07 
QuestionFSCTL_GET_VOLUME_BITMAP Pin
john563222-Dec-08 19:10
john563222-Dec-08 19:10 
QuestionDrag and Drop between tree controls (Very Urgent........) Pin
AnithaSubramani22-Dec-08 18:32
AnithaSubramani22-Dec-08 18:32 
AnswerRe: Drag and Drop between tree controls (Very Urgent........) Pin
Hamid_RT22-Dec-08 19:09
Hamid_RT22-Dec-08 19:09 
QuestionProgramming time for algorithm? Anyone help me................. Pin
thuyphuongid22-Dec-08 16:46
thuyphuongid22-Dec-08 16:46 
I have coded the following:
---------------------------------------------
//file BT01.h

class BT01
{
public:
int BruteForce(char *P, char *T);
void InputText(char *T, char *P);
};
---------------------------------------------------

//file BT01.cpp

#include "BT01.h"
#include "time.h"
#include "dos.h"
#include <iostream>
#include <conio.h>
#include <stdio.h>
using namespace std;

int BT01::BruteForce(char *P, char *T)
{
//duyet T
for (int i = 0; i <= strlen(T) - strlen(P); i++)
{
//khai bao j
int j = 0;
//duyet P
while (j < strlen(P))
{
//Kiem tra ptu tai T tai vi tri thu i + j co bang j hay khong? xu ly
if (tolower(T[i + j]) == tolower(P[j]))
j++;
else
break;
}
//Tim thay
if (j == strlen(P)) return i;
}
//khong tim thay
return -1;
}
void BT01::InputText(char *T, char *P)
{
do{
printf("T: ");
gets(T);
}
while (strlen(T) < 1);
do{
printf("P: ");
gets(P);
}
while(strlen(P) < 1 || strlen(P) > strlen(T));
}

void main()
{
char *P = new char[20];
char *T = new char[999];
printf("BAI TAP TH01 - THUAT TOAN BRUTEFORCE\n");

BT01 objBT01;
objBT01.InputText(T, P);

int kq;
kq = objBT01.BruteForce(P, T);

if (kq == -1)
printf("KQ: Khong tim thay.");
else
printf("\nKQ: %i, %i", kq, strlen(T));
printf("\nThoi gian (ms): ");

getch();
}

I would like to count time for Algorithm BruteForce. How to count?

modified on Monday, December 22, 2008 11:00 PM

AnswerRe: Programming time for algorithm? Anyone help me................. Pin
L. Madhavan22-Dec-08 19:41
L. Madhavan22-Dec-08 19:41 
Question[VC++6.0]Unhandled exception in **.exe, 0xc0000005:Access Vialation Pin
kaviniswell22-Dec-08 16:30
kaviniswell22-Dec-08 16:30 
AnswerRe: [VC++6.0]Unhandled exception in **.exe, 0xc0000005:Access Vialation Pin
Garth J Lancaster22-Dec-08 18:00
professionalGarth J Lancaster22-Dec-08 18:00 
GeneralRe: [VC++6.0]Unhandled exception in **.exe, 0xc0000005:Access Vialation Pin
kaviniswell22-Dec-08 18:18
kaviniswell22-Dec-08 18:18 
GeneralRe: [VC++6.0]Unhandled exception in **.exe, 0xc0000005:Access Vialation Pin
Garth J Lancaster22-Dec-08 18:27
professionalGarth J Lancaster22-Dec-08 18:27 
GeneralRe: [VC++6.0]Unhandled exception in **.exe, 0xc0000005:Access Vialation Pin
kaviniswell22-Dec-08 18:37
kaviniswell22-Dec-08 18:37 
QuestionCallback Intro Pin
codemunkeh22-Dec-08 15:45
codemunkeh22-Dec-08 15:45 
AnswerRe: Callback Intro Pin
CPallini23-Dec-08 3:05
mveCPallini23-Dec-08 3:05 
QuestionSetWindowSubclass is killing my app! Pin
KellyR22-Dec-08 14:17
KellyR22-Dec-08 14:17 
AnswerRe: SetWindowSubclass is killing my app! Pin
Naveen22-Dec-08 18:57
Naveen22-Dec-08 18:57 
GeneralRe: SetWindowSubclass is killing my app! Pin
KellyR22-Dec-08 19:19
KellyR22-Dec-08 19:19 
GeneralRe: SetWindowSubclass is killing my app! Pin
Mark Salsbery23-Dec-08 5:50
Mark Salsbery23-Dec-08 5:50 
QuestionVC Application with password Pin
sunny_vc22-Dec-08 13:38
sunny_vc22-Dec-08 13:38 
AnswerRe: VC Application with password Pin
Garth J Lancaster22-Dec-08 15:17
professionalGarth J Lancaster22-Dec-08 15:17 
AnswerRe: VC Application with password Pin
Chandrasekharan P22-Dec-08 17:25
Chandrasekharan P22-Dec-08 17:25 
AnswerRe: VC Application with password Pin
Mustapha Rédouane23-Dec-08 0:06
Mustapha Rédouane23-Dec-08 0:06 
QuestionVC++ 6.0 to VC++ 9.0 porting issue. Runtime Assertion for Keyboard handler Pin
pratap198022-Dec-08 10:45
pratap198022-Dec-08 10:45 

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.