2008秋季-计算机软件基础-0827课堂用例
#include<stdio.h>
void main()
{
/*
struct jiangpaishu
{
char guojia[10];
int jinpai;
int yinpai;
int tongpai;
int zongshu;
};
int a=5;
struct jiangpaishu China=
{"China",51,34,15};
struct jiangpaishu jiangpaibang[204];
China.zongshu=China.jinpai+
China.yinpai+China.tongpai;
printf("%s,%d,%d,%d,%d"n",
China.guojia,China.jinpai,
China.yinpai,China.tongpai,
China.zongshu);
int jinpaishu=51;int i;
int *q=&jinpaishu;
int jinpai[3]={51,34,30};
int *po=&jinpai[0]; int *po=jinpai
printf("%d",*q);
for(i=0;i<=2;i++)
printf("%d ",po[i]);
for(i=0;i<=2;i++,po++)
printf("%d ",*po);
for(i=0;i<=2;i++)
printf("%d ",jinpai[i]);*/
/*struct jiangpaishu
{
char guojia[10];
int jinpai;
int yinpai;
int tongpai;
int zongshu;
};
struct jiangpaishu china;
struct jiangpaishu *po;
po=&china;
strcpy((*po).guojia,"China");
(*po).jinpai=51; china.jinpai=51
(*po).yinpai=34;
(*po).tongpai=30;
printf("%s"n",(*po).guojia);*/
struct jiangpaishu
{
char guojia[10];
int jinpai;
};
int i;
struct jiangpaishu jiangpai[3]=
{"China",51,"USA",34,"Russia",30};
struct jiangpaishu *po;
po=jiangpai;
for(i=0;i<=2;i++,po++)
printf("%s %d"n",(*po).guojia,(*po).jinpai);"
printf("%s %d"n",jiangpai[i].guojia,jiangpai[i].jinpai);
int a;
int *q=&a
*q=1;
a=1;
}
void main()
{
/*
struct jiangpaishu
{
char guojia[10];
int jinpai;
int yinpai;
int tongpai;
int zongshu;
};
int a=5;
struct jiangpaishu China=
{"China",51,34,15};
struct jiangpaishu jiangpaibang[204];
China.zongshu=China.jinpai+
China.yinpai+China.tongpai;
printf("%s,%d,%d,%d,%d"n",
China.guojia,China.jinpai,
China.yinpai,China.tongpai,
China.zongshu);
int jinpaishu=51;int i;
int *q=&jinpaishu;
int jinpai[3]={51,34,30};
int *po=&jinpai[0]; int *po=jinpai
printf("%d",*q);
for(i=0;i<=2;i++)
printf("%d ",po[i]);
for(i=0;i<=2;i++,po++)
printf("%d ",*po);
for(i=0;i<=2;i++)
printf("%d ",jinpai[i]);*/
/*struct jiangpaishu
{
char guojia[10];
int jinpai;
int yinpai;
int tongpai;
int zongshu;
};
struct jiangpaishu china;
struct jiangpaishu *po;
po=&china;
strcpy((*po).guojia,"China");
(*po).jinpai=51; china.jinpai=51
(*po).yinpai=34;
(*po).tongpai=30;
printf("%s"n",(*po).guojia);*/
struct jiangpaishu
{
char guojia[10];
int jinpai;
};
int i;
struct jiangpaishu jiangpai[3]=
{"China",51,"USA",34,"Russia",30};
struct jiangpaishu *po;
po=jiangpai;
for(i=0;i<=2;i++,po++)
printf("%s %d"n",(*po).guojia,(*po).jinpai);"
printf("%s %d"n",jiangpai[i].guojia,jiangpai[i].jinpai);
int a;
int *q=&a
*q=1;
a=1;
}