Dark Bit Factory & Gravity

PROGRAMMING => C / C++ /C# => Topic started by: Paul on September 21, 2007

Title: c++ Data?
Post by: Paul on September 21, 2007
I'm wondering how to include data in my c++ exe?

In blitz i would use the Data statement, for example:
Data 1,2,3
Data 2,4,6
Data 4,5,1
and the use
'Read ' to get the information back.
could anyone show me a quick example of how i would do this pealse :)
Title: Re: c++ Data?
Post by: va!n on September 21, 2007
hi paul.... i dont know much about c/cpp, but afaik you can or simple must do it, by using an array and directly store the datas to it...

Code: [Select]
DIM aYourArray   ; i dont really know atm how to write it in C/CPP
    {
        1,2,3
        2,4,6
        4,5,1
    }


Edit, possible it must look like this:

Code: [Select]
Int aYourArray[10] = { 1, 2, 3, 2, 4, 6, 4, 5, 1 };
Title: Re: c++ Data?
Post by: Paul on September 21, 2007
thx for the quick reply. Did it this way now :)
Title: Re: c++ Data?
Post by: Shockwave on September 21, 2007
Also if you want to keep your listing tidy, you can always include your arrays in with #include
Title: Re: c++ Data?
Post by: Paul on September 21, 2007
Do you mean having them in a separate file?
Title: Re: c++ Data?
Post by: Shockwave on September 21, 2007
Yep :)