Solved

This question is for shogi...

Posted on 1998-02-14
14
234 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

617 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