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

C++ PrintList函数代码示例

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

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



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

示例1: main

int main()
{
  printf("at beginning of main\n");

  FILE *fpIn;

  int MAX_SIZE = 100;
  int count = 0;
  int i;
  int tempArray[MAX_SIZE];
  int line[MAX_SIZE];
 
  // fpIn = fopen(*argv, "r" );

  fpIn = fopen("input1.txt", "r" );
  if( !fpIn )
    {
      printf("Unable to open: input1.txt\n" );
      exit(-1);
    }
 
  printf("before read in of file\n");
 
  while (!feof(fpIn))
  // while (fpIn != NULL)
   {
     fscanf(fpIn, "%d", line);
     //fgets(line, MAX_SIZE, fpIn); 
     tempArray[count] = line;
     count++;
    }                             

  printf("before print out of array for testing. Count: %d. \n", count);
  // Print out temp array for testing
  int j;
  for( j = 0; j < count; j++)
    {
      printf("%d", tempArray[j]);
    }
  
  printf("before putting infor into queue");
  // Put data into Queue
  for(i = 0; i < count ; i++)
    {
      put(tempArray[i]);
    }

  // Print out list
  printf("before printing list");
     
  PrintList();
  printf("after printing list");
 
  fclose(fpIn);
  return 0;
}
开发者ID:ccasey645,项目名称:OldMachine,代码行数:56,代码来源:main.c


示例2: main

int main(void)
{
  Menu menu;
  List list;

  InitList(&list);

  do {
    Data x;

    switch (menu = SelectMenu()) {
    case InsFront:
      x = Read("先頭に挿入", NO | NAME);
      InsertFront(&list, x);
      break;
    case InsRear:
      x = Read("末尾に挿入", NO | NAME);
      InsertRear(&list, x);
      break;
    case RmvFront:
      RemoveFront(&list);
      break;
    case RmvRear:
      RemoveRear(&list);
      break;
    case PrintCrnt:
      PrintCrntNode(&list);
      break;
    case RmvCrnt:
      RemoveCrnt(&list);
      break;
    case SrchNo:
      x = Read("探索", NO);
      if (SearchNode(&list, x, NoEqual) != NULL){
	PrintCrntNode(&list);
      }
      break;
    case SrchName:
      x = Read("探索", NAME);
      if(SearchNode(&list, x, NameEqual) != NULL){
	PrintCrntNode(&list);
      }
      break;
    case PrintAll:
      PrintList(&list);
      break;
    case Clear:
      ClearList(&list);
      break;
    }
  } while (menu != Term);

  TermList(&list);

  return (0);
}
开发者ID:hzd02765,项目名称:meikai,代码行数:56,代码来源:09-11.c


示例3: main

int main(){
	List L;
	CreateList(L);
	InsertElem(L, 1, 100);
	InsertElem(L, 2, 200);
	InsertElem(L, 3, 300);
	InsertElem(L, 6, 500);
	PrintList(L);
	backPrintList(L);
}
开发者ID:xuwenzhi,项目名称:dsa,代码行数:10,代码来源:twodirectlink.c


示例4: PrintCall

PRIVATE inline void PrintCall(GBUF *out, UNUSED(Node *node), callNode *u, int offset, UNUSED(Bool norecurse))
{
     gbputs("Call: ", out);
     PrintCRSpaces(out, offset + 2);
     PrintNode(out, u->name, offset + 2);
     PrintCRSpaces(out, offset + 2);
     gbputs("List: args", out);
     PrintCRSpaces(out, offset + 4);
     PrintList(out, u->args, offset + 4);
}
开发者ID:106ohm,项目名称:eigengraph,代码行数:10,代码来源:print-ast.c


示例5: main

int main(void)
{
   FILE *fp = OpenFile(FILENAME);
   List *head = CreateList(fp);

   fclose(fp);
   FreeList(PrintList(head));

   return EXIT_SUCCESS;
}
开发者ID:craigricker,项目名称:UCSD-Extension-C-Class,代码行数:10,代码来源:C2A6E4_main-Driver.c


示例6: main

int main (int argc, char* argv[])
{
  int dataInt[] = {1, 2, 3, 4, 5};
  CSinglyListNode* head = CreateTestList(dataInt, 5);
  PrintList(head);

  CSinglyListNode* deleteMe = NULL;

  // Test 1
  deleteMe = Find(head, 2);
  if (deleteMe)
  {
    if (!DeleteElement(&head, deleteMe))
      std::cout << "Can't delete : " << deleteMe->iData << std::endl;
  }
  PrintList(head);

  // Test 2
  deleteMe = Find(head, 7);
  if (!deleteMe)
  {
    std::cout << "This element 7 doesn't exist" << std::endl;
  }

  // Test 3
  deleteMe = Find(head, 5);
  if (deleteMe)
  {
    if (!DeleteElement(&head, deleteMe))
      std::cout << "Can't delete : " << deleteMe->iData << std::endl;
  }
  PrintList(head);

  // Test 3
  std::cout << "DeleteList..." << std::endl;
  DeleteList(&head);
  std::cout << "head now : " << head << std::endl;
  PrintList(head);

  std::cout << "bye" << std::endl;

  return 0;
}
开发者ID:bearlin,项目名称:study_pie_3ed,代码行数:43,代码来源:Demo.cpp


示例7: Test

// ====================测试代码====================
ListNode* Test(char* testName, ListNode* pHead1, ListNode* pHead2)
{
    if(testName != NULL)
        printf("%s begins:\n", testName);

    printf("The first list is:\n");
    PrintList(pHead1);

    printf("The second list is:\n");
    PrintList(pHead2);

    printf("The merged list is:\n");
    ListNode* pMergedHead = Merge(pHead1, pHead2);
    PrintList(pMergedHead);
    
    printf("\n\n");

    return pMergedHead;
}
开发者ID:fredzs,项目名称:Coding_Interview,代码行数:20,代码来源:MergeSortedLists.cpp


示例8: mprintf

// DataSetList::List()
void DataSetList::List() const {
  if (!hasCopies_) { // No copies; this is a Master DSL.
    if (DataList_.empty()) return;
    mprintf("\nDATASETS (%zu total):\n", DataList_.size());
  } else if (DataList_.empty()) {
    mprintf("  No data sets.");
    return;
  }
  PrintList( DataList_ );
}
开发者ID:hainm,项目名称:cpptraj,代码行数:11,代码来源:DataSetList.cpp


示例9: main

int main() {
  struct node *a = NULL;
  SortedInsert2(&a, MakeNode(1));
  SortedInsert2(&a, MakeNode(4));
  SortedInsert2(&a, MakeNode(10));
  struct node *b = NULL;
  SortedInsert2(&b, MakeNode(3));
  SortedInsert2(&b, MakeNode(9));
  SortedInsert2(&b, MakeNode(21));
  
  printf("a: "); PrintList(a);
  printf("b: "); PrintList(b);
  struct node *merged_and_sorted = SortedMerge(a, b);
  printf("merged_and_sorted: "); PrintList(merged_and_sorted);
  printf("a: "); PrintList(a);
  printf("b: "); PrintList(b);
  
  return 0;
}
开发者ID:ryanbriones,项目名称:linked-list-problems,代码行数:19,代码来源:14-sortedmerge-test.c


示例10: test6

void test6()
{
	LinkList list;
	LinkNode *ret = NULL;
	InitLinkList(&list);
	PushBack(&list, 3);
	PushBack(&list, 5);
	PushBack(&list, 4);
	PushBack(&list, 2);
	PushBack(&list, 1);
	PrintList(&list);
	//ret = FindNode(&list, 2);
	//InsertFrontNode(ret, 0);           //3 5 4 0 2 1
	//PrintList(&list);
	//ret=FindMidNode(&list);
	DelKNode(&list, 5);
	PrintList(&list);
	DestoryLinkList(&list);
}
开发者ID:clearoff,项目名称:learngit,代码行数:19,代码来源:test.c


示例11: main

int main()
{
	ListNode* pListHead = CreateList(0);
	for (int i = 1; i < 10; i++)
		InsertNode(&pListHead,i);
	
	PrintList(pListHead);
	
	return 0;
}
开发者ID:pirlck,项目名称:algorithm,代码行数:10,代码来源:JZInterview.cpp


示例12: TestPrintLots

void TestPrintLots() {
	List l = NULL;
	l = MakeArrayStackEmpty(l);
	int i=0;
	for (i = 0; i < 10; ++i) {
		Insert(i * i, l, l);
	}

	PrintList(l);

	List p = NULL;
	p = MakeArrayStackEmpty(p);
	Insert(7, p, p);
	Insert(5, p, p);
	Insert(3, p, p);
	Insert(1, p, p);
	PrintList(l);
	PrintLots(l, p);
}
开发者ID:wanghan,项目名称:my_code,代码行数:19,代码来源:exercise.c


示例13: main

int main() {
  struct node *only_one = MakeNode(1);
  MergeSort(&only_one);
  
  struct node *two = MakeNode(2);
  two->next = MakeNode(1);
  printf("two: "); PrintList(two);
  MergeSort(&two);
  printf("two: "); PrintList(two);
  
  int spec[8] = {19, 3, 99, 1, 22, 44, 12, 2};
  struct node *head = ListFromArray(spec, 8);
  
  printf("head: "); PrintList(head);
  MergeSort(&head);
  printf("head: "); PrintList(head);
  
  return 0;
}
开发者ID:ryanbriones,项目名称:linked-list-problems,代码行数:19,代码来源:15-mergesort-test.c


示例14: main

main() {
	struct node * HEADL1 = NULL;
	struct node * HEADL2 = NULL;

	PushNode(&HEADL1,9);
	PushNode(&HEADL1,7);
	PushNode(&HEADL1,5);
	PushNode(&HEADL1,2);
	PushNode(&HEADL1,1);
	PrintList(HEADL1);

	PushNode(&HEADL2,8);
	PushNode(&HEADL2,4);
	PushNode(&HEADL2,3);
	PrintList(HEADL2);

	struct node* dummyHEAD = NULL;
	dummyHEAD = MergeTwoSortedList(HEADL1, HEADL2);
	PrintList(dummyHEAD);
}
开发者ID:rohandev,项目名称:C,代码行数:20,代码来源:prob_1.c


示例15: main

int main(int argc, char const *argv[])
{
  List L;
  Position P;
  int i;

  L = CreateList(15);
  PrintList(L);

  for (i = 5; i < 12; ++i)
  {
    P = Find(L, i);
    deleteNode(P);
    PrintList(L);
  }

  DestroyList(L);
  
  return 0;
}
开发者ID:yangmiemie,项目名称:leetcode,代码行数:20,代码来源:delete_node_in_a_linked_list.c


示例16: main

int main()
{
	List L1, L2, L3;
	int flag1 = 0, flag2 = 0;
	Position P1;
	Position P2;
	int tmp1, tmp2;

	L1 = Initialize();
	L2 = Initialize();
	L3 = Initialize();
	P1 = L1;
	P2 = L2;
	//Insert(L1, 2);  //空插
	//Insert(L1, 5);	//尾部插入
	//Insert(L1, 7);  //尾部插入
	//Insert(L1, 3);  //普通插入
	//Insert(L1, 1);  //首部插入

	scanf("%d", &tmp1);
	if(tmp1 != -1){
		Insert(L1, tmp1, P1);
		P1 = P1->next;
		while(scanf("%d", &tmp1)){
			if(tmp1 != -1){
				Insert(L1, tmp1, P1);
				P1 = P1->next;
			}else{
				break;
			}
		}
	}

	scanf("%d", &tmp2);
	if(tmp2 != -1){
		Insert(L2, tmp2, P2);
		P2 = P2->next;
		while(scanf("%d", &tmp2)){
			if(tmp2 != -1){
				Insert(L2, tmp2, P2);
				P2 = P2->next;
			}else{
				break;
			}
		}
	}

	//L3 = Merge(L1, L2);
	L3 = Mix(L1, L2);
	PrintList(L3);

	return 0;

}
开发者ID:shawnelee88,项目名称:PAT,代码行数:54,代码来源:2_12.c


示例17: main

int main(void)
{
	//자료구조를 지역변수로 선언했기 때문에
	//다른 함수에서는 직접 접근할 수 없다.
	int aList[5] = { 0 };

	InitList(aList, 5);
	SortList(aList, 5);
	PrintList(aList, 5);
	return 0;
}
开发者ID:VincentCodeKim,项目名称:Book_C_DokhageStartC,代码行数:11,代码来源:codedevgood01.c


示例18: LispPrintStack

static void LispPrintStack(struct LispStack *s, char *name)
{
    int i;
    struct StackFrame *stack = s->stack;
    
    Lisp_printf("%s: stack pointer %d\n", name, s->stackPointer);
    for (i = 0; i < s->stackPointer; i++) {
        Lisp_printf("stack[%d] [%s] ", i, stack[i].name);
        PrintList(stack[i].value);
    }
}
开发者ID:f3yagi,项目名称:mysrc,代码行数:11,代码来源:alloc.cpp


示例19: main

int main()
{
	ListNode* head = NULL;

	PushElement( &head, 3);
	ListNode *temp = head;

	int i = 0;
	for( i = 0; i < 500; i++ )
	{
		PushElement( &head->next,  i % 20 );
		head = head->next;
	}

	head = temp;
	
#if 0
	PushElement( &head, 3);
	PushElement( &(head->next), 2 );
	PushElement( &(head->next->next), 2 );
	PushElement( &(head->next->next->next), 1 );
	PushElement( &(head->next->next->next->next, 3);
	PushElement( &(head->next->next->next->next->next), 2 );
	PushElement( &(head->next->next->next->next->next->next), 2 );
	PushElement( &(head->next->next->next->next->next->next), 1 );
	PushElement( &head, 3);
	PushElement( &(head->next), 2 );
	PushElement( &(head->next->next), 2 );
	PushElement( &(head->next->next->next), 1 );
//	PushElement( &(head->next->next->next->next), 1 );
#endif

	// Sort the linked list.
	MergeSortOnLL( &head );

	PrintList( head );

	RemoveDuplicatesFromList( head );
	
	PrintList( head );
}
开发者ID:akrsmangipudi,项目名称:progamming,代码行数:41,代码来源:RemovingDuplicatesInUnsortedLL.c


示例20: main

int main()
{
        struct edges *Node=NULL;
        char ch;
        int i,j,weight;
        scanf("%d %d",&n,&m);
        if(n<=0||n>=200000)
            exit(EXIT_FAILURE);
        if(m<=0||m>=200000)
            exit(EXIT_FAILURE);
        struct node *start[n];
        struct edges *ptr[n];
        for(i=0;i<n;i++)
        {
            start[i]=NULL;
            ptr[i]=NULL;
        }
        int k;
        for(k=0;k<m;k++)
        {
                scanf("%d %d %d",&i,&j,&weight);
                if(i<=0||i>=200000)
                    exit(EXIT_FAILURE);
                if(j<=0||j>=200000)
                    exit(EXIT_FAILURE);
                Node=NewNode();
                if(start[i]==NULL)
                        start[i]=(struct node*)Node;
                else
                        ptr[i]->next=Node;

                Node->vertex=j;
                Node->weight=weight;
                ptr[i]=Node;

                Node=NewNode();
                if(start[j]==NULL)
                        start[j]=(struct node*)Node;
                else
                        ptr[j]->next=Node;

               Node->vertex=i;
               Node->weight=weight;
               ptr[j]=Node;
        }

    for(i=0;i<n;i++)
    {
        printf("%d ->",i);
        PrintList((struct edges*)start[i]);
    }
    return 0;
}
开发者ID:prabaprakash,项目名称:Data-Structures-and-Algorithms-Programs,代码行数:53,代码来源:Adjacency+List.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ PrintLog函数代码示例发布时间: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