Solved

A siple c++ question again...

Posted on 1997-12-05
6
191 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
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 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 technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

770 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