Solved

A siple c++ question again...

Posted on 1997-12-05
6
203 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
Independent Software Vendors: 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!

 
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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
Which IDE to use to begin C++ training? 5 70
I could not build boost code, 10 107
Using Diagnostic tools in VS2015: Unresoved allocations 19 125
Path to  STL Map header file 1 80
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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 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.

749 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