Solved

calculate a reference key with parameters of 0-99 (100 entries max)

Posted on 2004-08-14
3
193 Views
Last Modified: 2010-04-01
Hi,

I am needing some advice on how to calculate a reference key.  The function I have is
int getReferenceKey(int key)
the value of the key is calculated by the formula
key=(location index)*10+(type index.)

thanks.

Kaz
0
Comment
Question by:KazIT
[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
  • 2
3 Comments
 
LVL 19

Expert Comment

by:mrwad99
ID: 11799399
Kaz

Can you clarify exactly what you are after please as it is not quite clear.

Cheers
0
 

Author Comment

by:KazIT
ID: 11803051
The program I am constructing will have up to 100 entries, consisting of say 6 columns of information.  Each line of each entry needs to have a reference key assigned to it.
0
 
LVL 19

Accepted Solution

by:
mrwad99 earned 500 total points
ID: 11803566
So just make some formula up and get a value from that.  You are already doing something like this according to your first post; simply chose another formula that generates a unique value.

If you have 100 entries, numbered 1-100 or 0 - 99, and six columns, numbered 1 - 6 or 0 -5, then a reference key could be entry * column with a little more 'spice' added to it.  Alternatively you could always use the address of each entry, that is guaranteed to be unique.

HTH
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

740 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