• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ printlist函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中printlist函数的典型用法代码示例。如果您正苦于以下问题:C++ printlist函数的具体用法?C++ printlist怎么用?C++ printlist使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了printlist函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main(void)
{
  char command;
  NodePointer list = NULL;
  
  printf("Online Bookstore Inventory Management Program.\n\nCommands are I (insert), D (delete), S (search by name),\n  V (search by rating), P (print), Q (quit).\n");
  
  
  do
  {
    printf("\nCommand?: ");
    scanf(" %c",&command);
    if(command >= 'a' && command <= 'z')
       command = command - 'a' + 'A';
    if(command == 'I')
      list = insert(list);
    else if(command == 'D')
      list = deletion(list);
    else if(command == 'S')
      search(list);
    else if(command == 'V')
      rate(list);
    else if(command == 'P')
      printlist(list);
    else if(command == 'Q')
      {
        list = quit(list);
        printlist(list);
        return 0;
      }
    else
      printf("Command invalid\n");
  }while(1);
  return 0;
}
开发者ID:vaibhavvijay,项目名称:APS-105,代码行数:35,代码来源:Max.c


示例2: main

int main()
{
	node* head = NULL;
	int numtoinsert;

	push(&head,3);
	push(&head,99);
	push(&head,32);
	push(&head,13);
	push(&head,30);

	printf("before inserting....\n");
	printlist(head);

	printf("Enter number where you want to insert\n");
	scanf("%d",&numtoinsert);

	insert(&head,numtoinsert);

	printf("after inserting\n");
	printlist(head);


	return 0;
}
开发者ID:skant1681,项目名称:code,代码行数:25,代码来源:ptp.c


示例3: main

/*
  application's main
//*/
int main()
{
  element_t* first = NULL;
  element_t* last = first;
  global_list_size = 0;

  // alloc
  puts("alloc");
  alloclist((void*) &first, (void*) &last);
  printf("\n");

  // output
  puts("elements - before");
  printlist(first);
  printf("\n");

  puts("sorting");
  sort((void*) &first);
  printf("\n");

  puts("elements - after");
  printlist(first);
  printf("\n");

  // free
  puts("free");
  freelist((void*) &first);
  printf("\n");

  // exit
  puts("READY.");
  exit(EXIT_SUCCESS);
}
开发者ID:Rubusch,项目名称:c,代码行数:36,代码来源:main.c


示例4: main

int main()
{
    int *nums1,*nums2;
    int m,n;
    m=1;
    n=6;
    nums1=(int *)malloc(sizeof(int) * (m+n));
    nums2=(int *)malloc(sizeof(int) * n);

    for(int i=0;i<m;i++)
    {
        *(nums1+i)=(i+2)*10;
    }
    for(int i=0;i<n;i++)
    {
        *(nums2+i)=(i+3)*10+5;
    }


    printf("array 1 is :");
    printlist(nums1,m);
    printf("array 2 is :");
    printlist(nums2,n);
    merge(nums1,m,nums2,n);

    printf("last is :");
    for(int i=0;i<m+n;i++)
    {
        printf("%d,",*(nums1+i));
    }
    printf("\n");
}
开发者ID:krugal,项目名称:mywork,代码行数:32,代码来源:main.cpp


示例5: testreversealternatenodes

void testreversealternatenodes()
{
	struct node* node = buildlistinsortedorder(10);
	printlist(node, "node");
	node = reversealternateknodes(node, 3);
	printlist(node, "node after alternate reverse by k");
}
开发者ID:pmiriyals,项目名称:C_Programs,代码行数:7,代码来源:driver.c


示例6: testrevbygivensize

void testrevbygivensize()
{
	struct node* node = buildlistinsortedorder(10);
	printlist(node, "node");
	node = reversebyknodes(node, 1);
	printlist(node, "after reversing by given size");
}
开发者ID:pmiriyals,项目名称:C_Programs,代码行数:7,代码来源:driver.c


示例7: testdeletealternatenodes

void testdeletealternatenodes()
{
	struct node* node = buildlistattailbyref(10);
	printlist(node, "node");
	deletealternatenodes(node);
	printlist(node, "node after deleting alternate nodes");
}
开发者ID:pmiriyals,项目名称:C_Programs,代码行数:7,代码来源:driver.c


示例8: main

int main()
{
    struct ListNode *p1,*p2,*head;
    for(int i=0;i<2;i++)
    {
        if(i ==0)
        {
            p1=(struct ListNode *)malloc(sizeof(struct ListNode));
            p1->val=i;
            p1->next=NULL;
            head=p1;
        }
        else
        {
            p2=(struct ListNode *)malloc(sizeof(struct ListNode));
            p2->val=i;
            p2->next=NULL;
            p1->next=p2;
            p1=p1->next;
        }
    }
    printf("origin:");
    printlist(head);
    p2=reverseList(head);
    printf("after:");
    printlist(p2);
}
开发者ID:krugal,项目名称:mywork,代码行数:27,代码来源:main.cpp


示例9: main

int main(int argc, char** argv)
{	
	int i;
 	int sz = atoi(argv[1]);
 	int element = atoi(argv[2]);
 	srand( (unsigned)time( NULL ));

	IntVectorPtr vector = VecNew(initialCapacity);

	for(i=0;i<sz+1;i++)
		vector = VecAdd(vector,rand()%100);

	printlist(vector, sz);

	if (argc == 3)
	{	
		VecQuickSort(vector);
		printf("\nThe position of the number %d is %d\n", element, VecBinarySearch(vector, element));
	} else if ( strcmp(argv[3], "-l") == 0 )
	{
		VecQuickSort2(vector, 1, sz-1);
		printf("\nThe position of the number %d is %d\n", element, VecBinarySearch2(vector->data, 0, sz, element));	
	}
		
		
	printlist(vector, sz);

	VecDelete(vector);
	return 0;
}
开发者ID:tsironis,项目名称:Vectors,代码行数:30,代码来源:main.c


示例10: main

int main(void){
	struct node* head;
	struct node* second;
	struct node* end;

	head=malloc(sizeof(struct node));
	second=malloc(sizeof(struct node));
	end=malloc(sizeof(struct node));
	
	head->data=1;
	head->next=second;

	second->data=2;
	second->next=end;

	end->data=3;
	end->next=NULL;

	printlist(head);

	printf("delete test\n");
	if(delete_key(head,5)){
		printf("no match with key found. nothing is deleted\n");
	}
	printlist(head);

	return 0;
}
开发者ID:kwagjj,项目名称:ds_practice,代码行数:28,代码来源:tut3.c


示例11: main

void main()
{ slink *head;
int n,x,i,j;
printf("请输入元素个数");
scanf("%d",&n);
head=creslink(n);
printf("\n");
printlist(head);
printf("\n");
printf("请输入插入的数据元素的值");
scanf("%d",&x);
printf("请输入要在哪个位序之前插入");
scanf("%d",&i);
insert(head, i,x);/*在单链表第i个元素前插入x*/
printf("\n");
printlist(head);/*输出单链表中结点的元素值*/
printf("请输入删除的数据元素的位序");
scanf("%d",&i);
j=Delete(head,i, &x);
printf("\n");
if(j)printf("%d",x);/*删除成功,则输出被删除结点的元素值*/
printf("\n"); 
printf("最终的链表变成:");
printlist(head);/*输出单链表中结点的元素值*/
turn(head);
printf("原地逆转后的链表变成:");
printlist(head);/*输出单链表中结点的元素值*/
}
开发者ID:xiaokangwang,项目名称:welovecueb,代码行数:28,代码来源:turn.r.cpp


示例12: main

int main()
{
	char ch[10],num[5];
	LinkList head;
	head=CreatList();
	printlist(head);
	printf(" Delete node (y/n):");
	scanf("%s",num);
	if(strcmp(num,"y")==0||strcmp(num,"Y")==0) 
	{
		printf("Please input Delete_data:");
		scanf("%s",ch);
		DeleteList(head,ch);
		printlist(head);
	}
	printf("Add node ? (y/n): ");
	scanf("%s",ch);
	if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0)
	{
		head=AddNode(head);
	}
	printlist(head);
	system("pause");
	DeleteAll(head);
}
开发者ID:homesangsang,项目名称:datastruct,代码行数:25,代码来源:linkedlist.c


示例13: main

int main(int argc, const char * argv[]){
    int d[8]={4,3,6,2,1,5};
	
	printlist(d,6);
	
	// Insert_Sort_Better(d,6);
	// printlist(d,6);

	// Insert_Shell_Sort(d,6);
	// printlist(d,6);

	// Bubble_Sort(d,6);
	// printlist(d,6);

	// Bubble_Sort2(d,6);
	// printlist(d,6);

	// MergeSort(d,6);
	// printlist(d,6);
	
	// Quick_Sort(d,0,5);
// 	printlist(d,6);
	
	// Select_Sort(d,6);
	// printlist(d,6);
	
	MakeMinHeap(d,6);
	MinheapsortTodescendarray(d,6);
	printlist(d,6);
}
开发者ID:ldong,项目名称:Data-structure-in-C,代码行数:30,代码来源:sorting_test.c


示例14: testrevrecur

void testrevrecur()
{
	struct node* node = buildlistinsortedorder(10);
	printlist(node, "node");
	revrecur(&node);
	printlist(node, "after reversing");
}
开发者ID:pmiriyals,项目名称:C_Programs,代码行数:7,代码来源:driver.c


示例15: testmergesort

void testmergesort()
{
	struct node* node = buildlistattailbyref(20);
	printlist(node, "node before sorting");
	mergesort(&node);
	printlist(node, "node after sorting");
}
开发者ID:pmiriyals,项目名称:C_Programs,代码行数:7,代码来源:driver.c


示例16: main

int main(void) {
    printf("starting\n");

    struct node* head;
    head=malloc(sizeof(struct node));
    head->data=0;
    head->next=NULL;

    int i;
    for(i=0; i<10; i++) {
        printf("i: %d\n",i);
        addnode(head,i+1);
    }
    printf("starting printlist\n");
    printlist(head);

    int index_fromend=3;
    struct node* rec_ptr=Nthfromend(head,index_fromend);
    if(rec_ptr!=NULL) {
        printf("%dth data from end: %d\n",index_fromend,rec_ptr->data);
    }


    for(i=0; i<10; i++) {
        random_addnode(head);
    }

    printlist(head);



    return 0;

}
开发者ID:kwagjj,项目名称:ds_practice,代码行数:34,代码来源:tut5.c


示例17: testrotate

void testrotate()
{
	struct node* node = buildlistinsortedorder(10);
	printlist(node, "node");
	RightRotate(&node, 2);
	printlist(node, "node after rotating");

}
开发者ID:pmiriyals,项目名称:C_Programs,代码行数:8,代码来源:driver.c


示例18: testinsertsort

void testinsertsort()
{
	struct node* node = NULL;
	node = buildlistattailbyref(10);
	printlist(node, "before sorting the list");
	insertsort(&node);
	printlist(node, "after sorting the list ");
}
开发者ID:pmiriyals,项目名称:C_Programs,代码行数:8,代码来源:driver.c


示例19: testinsertnth

void testinsertnth()
{
	struct node* node = NULL;
	node = buildlistattailbyref(10);
	printlist(node, "at tail by local ref ");
	insertnth(&node, 10, 100);
	printlist(node, " after inserting at node 10");
}
开发者ID:pmiriyals,项目名称:C_Programs,代码行数:8,代码来源:driver.c


示例20: testmovelastnode

void testmovelastnode()
{
	struct node* node = buildlistattailbyref(10);
	printlist(node, "node");
	movelastnodetofirst(&node);
	printlist(node, "after moving last node to first");

}
开发者ID:pmiriyals,项目名称:C_Programs,代码行数:8,代码来源:driver.c



注:本文中的printlist函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ println函数代码示例发布时间:2022-05-30
下一篇:
C++ printline函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap