Solved

This question is for shogi...

Posted on 1998-02-14
14
224 Views
Last Modified: 2010-04-10
Hi, one more question.  How do I have it check to see if the last ten numbers are the ten numbers in regnum.dat / the amount of digits in the username (Edit2)? This will be added to the end of my edited codes.  For example if the number in regnum.dat is 250000000000 and the number of digits in the username (Edit2) is 5 the last ten digits will be 50000000000.

thanks,

steven
0
Comment
Question by:Perl_Man
  • 7
  • 7
14 Comments
 

Author Comment

by:Perl_Man
ID: 1182031
Edited text of question
0
 

Author Comment

by:Perl_Man
ID: 1182032
ps the / means devided by
0
 
LVL 2

Accepted Solution

by:
shogi earned 30 total points
ID: 1182033
Do not know if I understand you question, but I give you a sample code how to valid ...  I make my example with 11, because in your question you have 12 digits and it's seen you want the last 11.

Don't forget I'll not able to answer after sunday...for 1 week!

example :

// 1 edit1 field and 1 button to valid

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    int ValidationOk = 1;

    // here I will make a constant, but this number come from you file
    char ValidNumber[15] = "250000000000";
    // Here I give an example with a fixe number of chartere in the field
    char Text1[30];
    Edit1->GetTextBuf(Text1, 30);

    // testing size
    int SizeEdit = (Edit1->GetTextLen()) -1;
    int MAX_VALID = 11;   // 11 last number I want to valid
    int SizeValidNumber = strlen(ValidNumber) - 1;

    // validation
    for (; MAX_VALID>0 && SizeValidNumber>=0 && SizeEdit >= 0;
         MAX_VALID--,SizeValidNumber--, SizeEdit--)
    {
      if (ValidNumber[SizeValidNumber]!= Text1[SizeEdit])
         ValidationOk = 0;
    }

    if (ValidationOk && MAX_VALID==0)
         Application->MessageBox("I have a valid number",
                                  "Validation", MB_OK);
    else
         Application->MessageBox("Error: I don't have a valid number",
                                 "Validation", MB_OK);


}

0
 

Author Comment

by:Perl_Man
ID: 1182034
Ok I do not think u understand my question.  I will ahve my program randomaly generate a number (ten digits long) and save it in regnum.dat.  What I need you to do is make some codes up (for me to add to the end of the current validation codes) that will check to see if the last ten digits (in Edit1) are the same digits that are in regnum.dat devided by the number of digits in Edit2.  So basically you are taking a ten digit number and deviding it by the number of digits (charecters) in Edit2.  By doing this is will be a lot harder for someone to guess the shareware registration code.
0
 

Author Comment

by:Perl_Man
ID: 1182035
ps I looked at my question and I did type more than 10 digits (in the example) sorry about that..
0
 
LVL 2

Expert Comment

by:shogi
ID: 1182036
Take a look to the code... if your Edit1 is my Edit1 and your number in your file it's my ValidNumber.  And MaX_VALID it's your max characters you want to valid.  My validation start to the end of Edit1 (your big validation code).

Here my understand:

in regnum = 4444444444

if in Edit2 I have 2 digits

regnum/2 = 2222222222

And you want that number

(2222222222) == The_Last_10_digit_of_my_MASK

it's that???.. feel sorry I have 48 hours without sleep, and I think my brain it's somewhere else :-)

If you need to speak me directly I'll be on IRC, with the same nickname shogi

0
 
LVL 2

Expert Comment

by:shogi
ID: 1182037
I'll take a look sunday afternoon...
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Perl_Man
ID: 1182038
ok, yeah I do not think you understand.  please reply ASAP.
0
 
LVL 2

Expert Comment

by:shogi
ID: 1182039
About my comment, what it's wrong??
0
 
LVL 2

Expert Comment

by:shogi
ID: 1182040
I'm sorry I have to go, but I'll try to take a look monday if I can access internet (i'm really not sure)...
regards, shogi
0
 
LVL 2

Expert Comment

by:shogi
ID: 1182041
Hi Perl_Man!!!
  I'm still around... but just 1 time by day until the end of the week.. so if you need more ... answer to the question I ask you.
Regards, Shogi
0
 

Author Comment

by:Perl_Man
ID: 1182042
Ok what I need is someway to see if the last 10 digits entered to Edit2 = regnum.dat (there will be 10 digits in it) / the number of charecters in Edit1.  Do you understand????  I also need this ASAP.  My program will be on the market March 1 and need it to be completed!
0
 
LVL 2

Expert Comment

by:shogi
ID: 1182043
just btw, in your edit1 it's not the MASK (Fix number of char) ?
0
 

Author Comment

by:Perl_Man
ID: 1182044
i do not understand.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now