Hi all.

I had a software exam the other day and one of the questions was :
Define a new data type called PC that contains data both about the computer and the monitor. The computer contains how much RAM (integer) and the processor speed (floating point number).
The monitor is made up of screen size (integer) and the colour [string of 10 caharacters].

Could somenone print up the answer for me to check it.

Thanks :)

Why don't you send us your answer and we'll check it?

Dave

"Define a new data type" means you're supposed to create a new class (or possibly three).

My answer was :

int computer, RAM, screensize;
float speed, monitor;
char colour;

void pc (computer, monitor);
computer = int RAM, float speed;
monitor = int screensize, char colour;

This didn't seem quite right to me.
Cheers

Please use code tags when you post code. Also
1) you didn't define a data type anywhere.
2) the pc function that you declared is not defined anywhere.
3) the parameters to pc() need to have a type declared.
4) monitor = int something is not valid syntax

Oh well. Its over now. The rest of it wasn't too bad just that was a bit tough. Never mind. Thanks for the help anyway.
Cheers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.