It is currently Sun Oct 22, 2017 6:51 am

All times are UTC - 5 hours




 Page 1 of 1 [ 4 posts ] 
Author Message
 Post subject: C++ VMK 5 - Data Types
PostPosted: Sun Aug 19, 2007 6:19 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
A number of commonly used C++ data types are described in this VMK. I discuss the int, float, double, and char types. After that, I describe how to use arrays and how they work a little differently with the char data type to make strings. We group data types into struct's and lastly I show you how to use a union.

I forgot to show you these links from msdn in the video but here they are:

http://msdn2.microsoft.com/en-us/library/ms858375.aspx
http://msdn2.microsoft.com/en-us/library/ms881376.aspx

One of them shows you how each data type is represented in memory, and the other shows you what are the valid numerical ranges for each data type in c++.


Last edited by Marek on Wed Apr 02, 2008 6:55 am, edited 1 time in total.

Offline
 Profile  
 
 Post subject:
PostPosted: Tue Apr 01, 2008 9:12 pm 

Joined: Fri Nov 23, 2007 1:00 am
Posts: 52
Location: Your PC
I want to store a extra value in the struct, but it seems you forgot to cover it. Example of what I want to do:

object.min.X = 1.0;
object.max.X = -1.0;

object.min.Y = 1.0;
object.max.Y = 1.0;


Offline
 Profile  
 
 Post subject:
PostPosted: Wed Apr 02, 2008 7:00 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
ajm113 wrote:
I want to store a extra value in the struct, but it seems you forgot to cover it. Example of what I want to do:

object.min.X = 1.0;
object.max.X = -1.0;

object.min.Y = 1.0;
object.max.Y = 1.0;


To do this, you will need to nest your structure. For example something like this:

struct Vector2 {
  float fX;
  float fY;
};

struct Object {
   Vector2 v2Min;
   Vector2 v2Max;
};

//inside your function you would then use:
Object obj;

//now you can do this:
obj.v2Min.fX = 1.0;
obj.v2Min.fY = 5.0;



Offline
 Profile  
 
 Post subject:
PostPosted: Wed Apr 02, 2008 5:29 pm 

Joined: Fri Nov 23, 2007 1:00 am
Posts: 52
Location: Your PC
Neat that seems to work! I'll update you with any more questions that I mite have later.

Thanks, ajm113! :D


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

cron