Solved

A siple c++ question again...

Posted on 1997-12-05
6
197 Views
Last Modified: 2010-04-10
How do I implement a "record" in c++

I nead a array with elements of different types.

say  array[a:double, b:string, c:int]
0
Comment
Question by:wqclatre
  • 3
  • 2
6 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1174856
struct record{
       double a;
       char *b;
       int c;
};
struct record array[100];

0
 
LVL 4

Expert Comment

by:jos010697
ID: 1174857
I apologize for the off topic reply, but please allow me
to say something to 'ozo'. I've noticed that you've supplied
quite a lot of correct and helpful answers, but would you
please be so kind to tag them as an answer, instead of
a comment? As long as a question stays unanswered, it keeps
hanging around in the question pool and can't be graded ...

sorry for the intrusion,

kind regards,

Jos aka jos@and.nl


0
 
LVL 84

Expert Comment

by:ozo
ID: 1174858
Thank you jos, but while you may judge my answers correct,
I prefer to wait to hear that the person who asked the question
has found it helpful before I officially tag them as an answer.
(I've found that sometimes, the question they really meant to ask
may be rather different from the one I correctly answer:-)
If this habit has caused inconvenience, I apologize.
Is there a particular question hanging around now that wants to be graded?
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 2

Author Comment

by:wqclatre
ID: 1174859
Thanks!

Why as a comment??
0
 
LVL 4

Expert Comment

by:jos010697
ID: 1174860
To ozo,

it's not an inconvenience (how could it be? I'll simply
zap to the next question if I see an ansered/commented
question ;-)

I don't know about any 'open' questions at this very moment
(maybe in unix.programming?) but I simply noticed it a
couple of times; nothing too important actually, no need
to apologize.

kind regards,

Jos aka jos@and.nl

ps. Anser this one now and you'll get your points (whatever
    they're worth ;-)
0
 
LVL 84

Accepted Solution

by:
ozo earned 30 total points
ID: 1174861
struct{
        double a;
        char *b;
        int c;
} array[100];

array[0].a = 1.5;
array[0].b = "string";
array[0].c = 3;
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 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 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.

790 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