1
while(check) { cc=player(c,aa); bb=play(b,cc); aa=play(c,bb); check=a||b||c; }
int player(int c[],int aa[]) { int m[25]={0}; int i,j,k; int count=0; int xx=0; for(i=0;i { if(aa[i]!=0) { count++; if(count==1) x=1; if(count==2) x=2; } } switch(x) { case 1:{ printf("please enter a number;\n "); scanf("%d",xx); aa[0]=xx; } // case 2:fun2(v,m); }
for(i=0;i { printf("%3d",m[i]); } printf("\n"); return m; } int play(int v[],int vv[]) { int m[25]={0}; int i,j,k; int count=0; for(i=0;i { if(vv[i]!=0) { count++; if(count==1) x=1; if(count==2) x=2; } } switch(x) { case 1:fun1(v,m); // case 2:fun2(v,m); }
for(i=0;i { printf("%3d",m[i]); } printf("\n"); return m; }
void fun1(int v[],int m[]) { int t=0; t=v[1]; m[0]=t; v[1]=0; }
void fun2(int v[],int m[]) {
}
{ int a[10]={1,3,5,7,9,2,4,6,8,0}; 3 1 0 3 5 1 1 3 5 7 1 2 3 5 7 9 1 3 3 5 7 9 2 1 4 3 5 7 9 2 4 1 5 3 5 7 9 2 4 6 1 6 3 5 7 9 2 4 6 8 1 7 3 5 7 9 2 4 6 8 1 0 8 // 5 3 0 5 7 3 1 5 7 9 3 2 5 7 9 3 2 3 5 7 9 3 4 2 4 5 7 9 3 4 6 2 5 5 7 9 3 4 6 8 2 6 5 7 9 3 4 6 8 2 1 0 7 // 0 7 5 1 7 9 5 2 7 9 5 3 3 7 9 5 4 3 4 7 9 5 4 6 3 5 7 9 5 4 6 8 3 6 7 9 5 4 6 8 3 2 1 0 // 0 9 7 1 9 7 5 4 6 8 3 2 1 0 2 9 7 5 4 6 3 9 7 5 6 4 4 9 7 5 6 8 4 3 2 1 0 5 9 7 5 6 8 4 3 2 1 0 // 0 9 7 1 9 7 5 2 9 7 6 5 3 9 7 6 8 5 4 4 9 7 6 8 5 4 3 2 1 0 // 0 9 7 1 9 7 6 2 9 7 8 6 5 3 // 0 9 7 1 9 8 7 6 5 // 0 9 8
#include #include #define n 4 #define m 4 #define Datatype int typedef struct linklist { Datatype data; struct linklist *left; struct linklist *right; }linknode,*l,*r;
void fun1() { int i=0,j=0,k=0,a[n][m]={0}; for(i=0;i for(j=0;j { scanf("%d",&a[i][j]); printf("%2d",a[i][j]); }
}
void fun2() { int i=0,j=0,k=0,a[n][m]={0}; for(i=0;i for(j=0;j { scanf("%d",&a[i][j]); } fflush(stdin); for(i=0;i for(j=0;j { printf("%2d",a[i][j]); } fflush(stdout); } void fun3() { int a[10]={11,2,5,6,7,3,4,9,10,1}; int l; int i,j,t; int b[3]={10,10,10}; for(l=0;l
{ if(a[l]
b[0]=a[l]; for(i=0;i
{ for(j=i;j
{ if (b[j]
} } }
for(i=0;i
} void fun4() { int l=1; l mylist=(linknode* )malloc(sizeof(linknode)); //list headcopy=(linknode* )malloc(sizeof(linknode)); mylist->data=1;
} void main() { //printf("\n test 1 enter %d*%d number\n",n,m); //fun1(); //printf("\n test 2 enter %d*%d number\n",n,m); //fun2(); printf("\n test \n \n",n,m); //fun3(); fun4(); printf("\n test had finish\n",n,m);
}
#include #include #define Datatype int typedef struct linklist { Datatype data; struct linklist *next; }linknode,* list; void fun2(list head) { list p=head; while(p->next!=NULL) { p=p->next; printf("%d",p->data); } //free(head); } int judge(list mylist1) { int l=6,j=8;list p=mylist1; list s=mylist1,t=mylist1; printf("\n%d\n",l);
while(j){printf("%2d",p->data);p=p->next;j--;}
while(l){s=s->next;t=(t->next)->next; if(t->next=s){printf("\n it is loop\n");break;} l=l-1; }
return 0; } void ysf(list head) { int count=0;// 4; int r=4; list p=head->next; list del=NULL; while(r>1) { while(count
{ p=p->next; count++; } del=pd->next;r--; p->next=del->next; free(del); } } void main() {int l=1; list mylist=(linknode* )malloc(sizeof(linknode)); list headcopy=(linknode* )malloc(sizeof(linknode)); list mylist1=(linknode* )malloc(sizeof(linknode)); list p=mylist1; while(l
{ list newnode=(linknode* )malloc(sizeof(linknode)); newnode->data=l; p->next=newnode; p=p->next; l++; } p->next=mylist1->next; judge(mylist1); //wutoushan(); ysf(mylist); judge(mylist1);
} #include #include #include void display(int x,int y,int m,int max) { int s[6][7]={0};int i=0,j=0; s[0][m]=1;//确定每一月的根基 每个月的第一列 for(j=m;j
s[1][0]=s[0][6]+1; for(i=2;i
for(i=1;i
{ for(j=1;j
s[i][j]=s[i][0]+j; }
printf("\t%d年 %d月\n",x,y); printf("----------------------\n"); printf(" 日 一 二 三 四 五 六 \n"); for(i=0;i
{ for(j=0;j
{ if(s[i][j]==0)printf(" "); if(s[i][j]!=0&&s[i][j]
printf("\n"); } } int Year(int year) { if(year%4==0&&year%100!=0||year%400==0)return 1; else return 0; } void fun() { int i,j; int max[13]={0,30,31,32,33,30,30,30,30,30,30,30,30}; int star[13]={1,2,3,4,5,5,1,6,5,4,3,2,1,}; int x[42]={0}; for(i=1;i
{printf("%d year %d math\n",2015,i); printf(" 7 1 2 3 4 5 6 \n"); printf("---------------------\n" ); for(j=star[i];j
{ x[j]=x[j-1]+1;} for(j=0;j
{ if(j>0&&j%7==0)printf("\n"); if(x[j]==0)printf(" "); if(x[j]!=0&&x[j] } printf("-----happy new year---\n"); } } void main() { int max[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int year=2016; int month=2;//1-12 int star[13]={0,1,32,60,91,121,152,182,213,244,274,304,334};//0-6 int i=1; int count=0; if(Year(year)) {max[2]++;for(i=3;i
for(i=1;i{if(Year(i))count++;} for(i=1;i
{//star[i]= (1+2*i+3*(i+1)/5+year+year/4-year/100+year/400)%7; star[i]=(star[i]+(year-1)*365+count)%7; display(year,i,star[i],max[i]); } //fun(); }
|