int pole[m][n];
for(int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
fscanf(f, "%d", &pole[i][j]);
printf("%d ", pole[i][j]);
}
printf("\n");
}
for (int i = 0; i < m; i++)
{
x = 0;
for (int j = 0; j < n; j++)
{
switch (pole[i][j])
{
case 1:
brick(x, y, DarkGray);
printf("%d %d\n", x, y);
break;
case 0:
break;
default:
break;
}
x += 100;
}
y += 100;
}
#include<iostream>
#include<string>
#include<vector>
#include<set>
using namespace std;
class GameObject
{
string name;
public:
GameObject(string n) : name{n}
{
}
string getName()
{
return name;
}
};
vector<GameObject> ToVector(const set<GameObject*>& cont)
{
vector<GameObject> res;
res.reserve(cont.size());
for(auto& p : cont)
{
if(p) res.push_back(*p);
}
return res;
}
int main()
{
set<GameObject*> gset = {
new GameObject("one"),
new GameObject("two"),
new GameObject("three")
};
vector<GameObject> test{ToVector(gset)};
for(auto& v : gset)
{
cout << v->getName() << " ";
delete v;
}
cout << '\n';
for(auto& v : test)
{
cout << v.getName() << " ";
}
cin.get();
}
на питоне и си шарпе эту проблему решил формат decimal
auto&& UTIL_FileRead = [](auto& fname)
{
ifstream in(fname, ios::binary);
string data;
//...
if(!in)
{
//CONSOLE_Print("[UTIL] warning - unable to read file [" + fname + "]");
return data;
}
in.seekg(0, ios::end);
uint32_t FileLength = in.tellg();
in.seekg(0, ios::beg);
data.resize(FileLength);
in.read((char*)data.data(), FileLength);
return data;
};
string m_MapData{ UTIL_FileRead(m_GHost->m_MapPath + m_MapLocalPath) };
if(!m_MapLocalPath.empty() && CFG->GetInt("mcd_allow", 1) == 1)
{
vector<unsigned char> b{m_MapData.begin(), m_MapData.end()};
m_MCD.Parse(b);
m_HasMCD = true;
m_MapData.clear();
m_MapData.shrink_to_fit();
m_MapData.reserve(b.size());
m_MapData.insert(m_MapData.begin(), b.begin(), b.end());
}string UTIL_FileRead( string file )char *Buffer = new char[FileLength];
IS.read( Buffer, FileLength );
string BufferString = string( Buffer, IS.gcount( ) );
IS.close( );
delete [] Buffer;