#include<stdio.h>
#include<string.h>
#define AS 5
#define QW 20
#define RR 2
struct ww {
char w[QW];
char e[QW];
char r[QW];
};
struct ss {
char q[QW];
struct ww f;
};
void vv(struct ss *g);
struct ss h[AS];
int main(void)
{
char* ch;
char cc;
int a = 0;
struct ss* pc;
char d[QW];
while (a < RR)
{
pc = &h[0];
printf("请输入社会保险号:");
gets_s((pc+a)->q, QW - 1);
printf("请输入成员代表名:");
gets_s((pc+a)->f.w, QW - 1);
printf("请输入成员中间名:");
ch = gets_s(d, QW - 1);
if (ch)
{
strncat_s((pc + a)->f.e, d, 1);
if (d[0] != NULL)
{
strncat_s((pc + a)->f.e, ".", 1);
}
}
printf("请输入成员姓:");
gets_s((pc+a)->f.r, QW - 1);
a++;
}
vv(h);
return 0;
}
void vv(struct ss *g)
{
for (int y = 0; y < RR; y++)
{
printf("%s,%s%s,%s\n", (g + y)->f.r, (g + y)->f.e, (g + y)->f.w, (g + y)->q);
}
}
C语言嵌套结构的编程
最新推荐文章于 2023-04-04 23:40:38 发布