C/C++の宿題を片付けます 64代目
■ このスレッドは過去ログ倉庫に格納されています
0170デフォルトの名無しさん
2006/05/04(木) 16:45:30table を二項目ふやせば?
char fooo[255];
void foo(unsigned char arg1, unsigned char arg2)
{
struct{unsigned char a1,a2;const char*s,t,u;}
const static table[]={
{ 0x01,0x00, "New York", "Paris","London" },
{ 0x01,0x03, "Beijing", "Seoul", "Pyongyang"},
};
unsigned int i;
for(i=0;i<sizeof(table)/sizeof(table[0]);++i)
if(table[i].a1==arg1&&table[i].a2==arg2){
strcpy_s(fooo, table[i].s);
strcpy_s(foooo, table[i].t);
strcpy_s(fooooo, table[i].u);
return;
}
strcpy_s(fooo, "1, 2byteが不正な値です");
}
というか規模が大きくなるようなら、ファイルから読み込むかリソースに汁
■ このスレッドは過去ログ倉庫に格納されています