예제 #1
0
파일: main1.c 프로젝트: Alecs94/DSA-lab
int main()
{
    Sant* santi=(Sant*)malloc(sizeof(Sant));
    initializeSent(santi);
    //santi->head=NULL;
    // santi->tail=NULL;
    char s[30];
    int x;
    out=fopen("out.txt","w");
    in=fopen("in.txt","r");
    int c;
    c=fscanf(in,"%s %d",s,&x);
    while(c>0)
    {
        //printf("%s %d\n",s,x);
        if(!strcmp(s,"AL"))addLast(santi,x);
        if(!strcmp(s,"AF"))addFirst(santi,x);
        if(!strcmp(s,"DE"))delete_element(santi,x);
        if(!strcmp(s,"PRINT_F"))print_first(santi,x);
        if(!strcmp(s,"PRINT_L"))print_last(santi,x);
        if(!strcmp(s,"PRINT_ALL"))printlist(santi);
        if(!strcmp(s,"DOOM_THE_LIST"))doom_the_list(santi);
        if(!strcmp(s,"DF"))delete_first(santi);
        if(!strcmp(s,"DL"))delete_last(santi);
        strcpy(s,"");
        c=fscanf(in,"%s %d",s,&x);

    }
    return 0;
}
예제 #2
0
int main()
{
    int peop_num = 100;            /*定义传入参数的个数*/
    int array[peop_num];           /*定义数组*/ 
 
    init_array(array,peop_num);    /*调用初始化函数先对数组进行初始化*/

    print_last(array,peop_num);    /*通过函数ptint_last求出最后一个人的号码并打印输出*/

    return 0;
     
}
JNIEXPORT void JNICALL
Java_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj)
{
	print_first();
	int ch;
	do
	{
		start(degree_difficulty());
		printf("1:再来一局\n2:退出\n请选择:");
		fflush(stdin);
		scanf("%d", &ch);
	} while (ch == 1);
	print_last();
	return;
}
예제 #4
0
int main()
{
   int peop_num = 100;
   int out_num = 3;
   creat_circle(peop_num);
   
   struct people *temp_node = head;
   
   printf("数组中的数是:");
   print_all();
   
   
   printf("\n");

   printf("%d\n", print_last(peop_num,out_num));

   print_all();
   
   printf("检测是否释放完毕如果返回值为1释放完毕:\n");
   printf("返回值:%d\n",free_all());
   return 0;
}