Solved

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

Posted on 2004-08-14
3
189 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
  • 2
3 Comments
 
LVL 19

Expert Comment

by:mrwad99
Comment Utility
Kaz

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

Cheers
0
 

Author Comment

by:KazIT
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

744 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

11 Experts available now in Live!

Get 1:1 Help Now