Solved

This question is for shogi...

Posted on 1998-02-14
14
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

739 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