Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <istream>
- #include <conio.h>
- #include <vector>
- #include<fstream>
- using namespace std;
- // Number of elements in an array
- template <typename T, int N> char (&array(T(&)[N]))[N];
- class sphere
- {
- public:
- int x,y,z;
- };
- class m_Array
- {
- int size;
- sphere *arry;
- public:
- //constructor
- m_Array(int size)
- {
- arry = new sphere[size];
- }
- float addSphere(int x,int y,int z)
- {
- int lenght=sizeof(this->arry);
- this->arry[lenght].x=x;
- this->arry[lenght].y=y;
- this->arry[lenght].z=z;
- }
- sphere *resizeArray(int old_size, int new_size)
- {
- sphere *ret_array;
- ret_array = new sphere[new_size];
- int i;
- for(i=0; i < new_size && i < old_size; i++)
- ret_array[i] = this->arry[i];
- delete [] this->arry;
- return ret_array;
- }
- /* int *copyArray(int *arry)
- {
- Array second=arry;
- return second;
- }*/
- ~m_Array()
- {
- delete []arry;
- }
- }
- /*
- void loadSphere();
- int _tmain(int argc, _TCHAR* argv[])
- {
- return 0;
- }
- void loadSphere()
- {
- Array *arr;
- Array ar= Array(30);
- fstream myFile ("data.bin", ios::in | ios::out | ios::binary);
- /* myFile.seekp (0);
- myFile.write ((char*)&ar, sizeof (Array));
- myFile.seekg (0);
- myFile.read ((char*)arr, sizeof (Array) * 10);
- myFile.close();
- }
- void saveSphere(Array arry)
- {
- fstream myFile ("data.bin", ios::in | ios::out | ios::binary);
- myFile.write ((char*)&arry, sizeof (Array));
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement