#include "stdio.h"
#include "stdlib.h"
int main()
{
int prs,i,j; /* i是计数器 */
printf("Please input the person how mang you want:");
scanf("%d",&prs);
int *date=(int *)malloc(sizeof(int)*prs);
if(date==NULL) exit(1);
for(i=1;i<prs;i++) /* error C2065: 'P' : undeclared identifier */
*(date+i-1)=i; /* error C2446: '<' : no conversion from 'int *' to 'int' */
/* error C2040: '<' : 'int' differs in levels of indirection from 'int *' */
i=1;
while(prs!=1)
{
i++;
if(i%3==0)
{ if(prs==2)
printf("\nThe last people's number is :%d\n",*(date+1));
for(j=i;j<prs;j++)
*(date+j)=*(date+j+1);
prs--;i=1;
}
}
//printf("\nThe last people's number is :%d\n",*p);
return 0;
}
#include "stdlib.h"
int main()
{
int prs,i,j; /* i是计数器 */
printf("Please input the person how mang you want:");
scanf("%d",&prs);
int *date=(int *)malloc(sizeof(int)*prs);
if(date==NULL) exit(1);
for(i=1;i<prs;i++) /* error C2065: 'P' : undeclared identifier */
*(date+i-1)=i; /* error C2446: '<' : no conversion from 'int *' to 'int' */
/* error C2040: '<' : 'int' differs in levels of indirection from 'int *' */
i=1;
while(prs!=1)
{
i++;
if(i%3==0)
{ if(prs==2)
printf("\nThe last people's number is :%d\n",*(date+1));
for(j=i;j<prs;j++)
*(date+j)=*(date+j+1);
prs--;i=1;
}
}
//printf("\nThe last people's number is :%d\n",*p);
return 0;
}