当前位置: 首页>>代码示例>>C++>>正文


C++ PrintList函数代码示例

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


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


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