[表示 : 全て 最新50 1-99 101- 201- 301- 401- 501- 601- 701- 801- 901- 2chのread.cgiへ]
Update time : 05/09 20:36 / Filesize : 218 KB / Number-of Response : 953
[このスレッドの書き込みを削除する]
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧] [類似スレッド一覧]


↑キャッシュ検索、類似スレ動作を修正しました、ご迷惑をお掛けしました

C++相談室 part78



914 名前:デフォルトの名無しさん mailto:sage [2010/03/14(日) 23:34:08 ]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct TestData {
int id; char *name; char *sp; char *sx;
int nr_param; char *param;
} TestData;
#define PARA(max,at,sp) ":" #max "," #at "," #sp
static TestData test_array[] = {
{ 1, "NA", "SpA", "M", 3, PARA(0, 0, 1) PARA(2, 3, 4) PARA(5, 6, 7), },
{ 2, "NB", "SpB", "???", 1, PARA(1, 2, 3), },
};
void dump_testdata(TestData *t) {
int i;
const char *p;
printf(" Id:%d, Name:%s, Sp:%s, Sx:%s\n", t->id, t->name, t->sp, t->sx);
p = t->param;
for ( i = 0; i < t->nr_param ;i++) {
int m, a, s;
m = atoi(p = strchr(p, ':')+1);
a = atoi(p = strchr(p, ',')+1);
s = atoi(p = strchr(p, ',')+1);
printf(" param: max:%d, attack:%d, speed:%d\n", m, a, s);
}
}
int main(void) {
dump_testdata(&test_array[0]);
dump_testdata(&test_array[1]);
return 0;
}







[ 続きを読む ] / [ 携帯版 ]

全部読む 前100 次100 最新50 [ このスレをブックマーク! 携帯に送る ] 2chのread.cgiへ
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧]( ´∀`)<218KB

read.cgi ver5.27 [feat.BBS2 +1.6] / e.0.2 (02/09/03) / eucaly.net products.
担当:undef