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

C++ print_all函数代码示例

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

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



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

示例1: main

int main () {
    Link* norse_gods = new Link("Thor");
    norse_gods = norse_gods->insert(new Link("Odin"));
    norse_gods = norse_gods->insert(new Link("Zeus"));
    norse_gods = norse_gods->insert(new Link("Freia"));

    Link* greek_gods = new Link("Hera");
    greek_gods = greek_gods->insert(new Link("Athena"));
    greek_gods = greek_gods->insert(new Link("Mars"));
    greek_gods = greek_gods->insert(new Link("Poseidon"));
    
    Link* g = greek_gods->find("Mars");
    if (g) g->value = "Ares";

    Link* n = norse_gods->find("Zeus");
    if (n == norse_gods) norse_gods = n->next();

    n->erase();
    greek_gods = greek_gods->insert(n);
    
    print_all(norse_gods);
    cout << "======================" << endl;
    print_all(greek_gods);

    keep_window_open();
}
开发者ID:diversario,项目名称:cpp_book,代码行数:26,代码来源:Source.cpp


示例2: main

int main()
{
	Link* gods = new Link{God{"Athena", "Greek", "", "knowledge"}};
	gods = gods->insert(new Link{God{"Loki", "Norse", "", "Loki's staff"}});
	gods = gods->insert(new Link{God{"Poseidon", "Greek", "", "water"}});
	gods = gods->insert(new Link{God{"The Many-Faced", "ASoIaF", "masks", "death"}});
	gods = gods->insert(new Link{God{"Zeus", "Greek", "", "lightning"}});
	gods = gods->insert(new Link{God{"R'hllor", "ASoIaF", "prayer", "fire"}});
	gods = gods->insert(new Link{God{"Thor", "Norse", "Rainbow Bridge", "Mjolnir"}});
	gods = gods->insert(new Link{God{"The Other", "ASoIaF", "dead things", "ice"}});
	gods = gods->insert(new Link{God{"Odin", "Norse", "Sleipner", "Gungir"}});

	Link* greek_gods;
	Link* norse_gods;
	Link* iceandfire_gods;

	while (gods) {
		if (gods->value.mythology == "Greek") {
			greek_gods = greek_gods->insert(new Link{gods->value});
		}
		else if (gods->value.mythology == "Norse") {
			norse_gods = norse_gods->insert(new Link{gods->value});
		}
		else if (gods->value.mythology == "ASoIaF") {
			iceandfire_gods = iceandfire_gods->insert(new Link{gods->value});
		}
		gods = gods->next();
	}

	print_all(iceandfire_gods);
	print_all(norse_gods);
	print_all(greek_gods);
}
开发者ID:Kijjakarn,项目名称:Stroustrup-PPP2-Exercises,代码行数:33,代码来源:ch17_ex13.cpp


示例3: main

int main() {
	Link* norse_gods = new Link {"Thor"};
	norse_gods = norse_gods->insert(	new Link {"Odin"});
	norse_gods = norse_gods->insert(new Link {"Zeus"});
	norse_gods = norse_gods->insert(new Link {"Loki",});
	Link* greek_gods = new Link {"Hera"};
	greek_gods = greek_gods->insert(new Link {"Athena"});
	greek_gods = greek_gods->insert(new Link {"Mars"});
	greek_gods = greek_gods->insert(new Link {"Poseidon"});

	Link* p = greek_gods->find("Mars");
	//std::cout << norse_gods->succ->value << " : " << greek_gods->succ->value << std::endl;
	if (p) p->value = "Ares";
	//std::cout << norse_gods->succ->value << " : " << greek_gods->succ->value << std::endl;
	Link* p2 = norse_gods->find("Zeus");
	if (p2) {
		if (p2 == norse_gods) norse_gods = norse_gods->next();
		p2->erase();
		greek_gods = greek_gods->insert(p2);
	}
	//std::cout << norse_gods->value << " : " << greek_gods->succ->value << std::endl;
	print_all(norse_gods);
	greek_gods = greek_gods->add(new Link {"Hades"});
	greek_gods = greek_gods->previous();
	print_all(greek_gods);

	/*Chapter 17 Exercise 12
	Why did we define two versions of find()?
	*/

	const Link* const_test = new const Link {"Test"};
	const Link* sp = const_test->find("Test");
	std::cout << sp->value << std::endl;
	std::cout << greek_gods->previous() << std::endl;
}
开发者ID:thelastpolaris,项目名称:Programming-Principles-and-Practice-Using-C-,代码行数:35,代码来源:ex11-12.cpp


示例4: main

int main()
{
    print_all(1, 3.14, 'c', "Hello");
    
    std::cout << std::endl;
    
    print_all(1, 'c');
}
开发者ID:CCJY,项目名称:coliru,代码行数:8,代码来源:main.cpp


示例5: print_all

void print_all(TREE_NODE *root, print_function f, int level){
  if (root)
  {
    f(root, level);
    print_all(root->left, f, level + 1);
    print_all(root->right, f, level + 1);
  }

}
开发者ID:adrianob,项目名称:word_search,代码行数:9,代码来源:btree.c


示例6: main

int main(void){
    int a[] = {2, 8, 5, 1, 9, 4};
    print_all(a, ARRAY_LEN(a));
    printf("\n");
    insertion_sort(a, ARRAY_LEN(a));
    printf("\n");
    print_all(a, ARRAY_LEN(a));

    return 0;
}
开发者ID:benzhemin,项目名称:xnixc,代码行数:10,代码来源:insertion_sort.c


示例7: main

int main()
{
	// norse gods
	God god_temp = God{"Thor", "A chariot pulled by two goats (that he eats and"
		" resurrects", "Mountain-crushing hammer called Mjolnir", 
		Mythology::Norse};
	Link* norse_gods{new Link{god_temp, nullptr, nullptr}};

	god_temp = God{"Odin", "Eight-legged flying horse called Sleipnir", 
		"Spear called Gungnir", Mythology::Norse};
	norse_gods = norse_gods->add_ordered(new Link{god_temp});
	
	god_temp = God{"Freia", "A chariot pulled by two cats", "A feathered cloak", 
		Mythology::Norse};
	norse_gods = norse_gods->add_ordered(new Link{god_temp});

	// greek gods
	god_temp = God{"Zeus", "The Chariot of Zeus", "Thunderbolts", 
		Mythology::Greek};
	Link* greek_gods{new Link{god_temp, nullptr, nullptr}};

	god_temp = God{"Athena", "None", "An extremely long spear", Mythology::Greek};
	greek_gods = greek_gods->add_ordered(new Link{god_temp});

	god_temp = God{"Ares", "His war chariot", "A spear and helmet", 
		Mythology::Greek};
	greek_gods = greek_gods->add_ordered(new Link{god_temp});
	god_temp = God{"Poseidon", "A chariot pulled by a winged hippocampus, or"
		" horses that can ride on the sea itself", "A trident", 
			Mythology::Greek};
	greek_gods = greek_gods->add_ordered(new Link{god_temp});

	// Egyptian gods
	god_temp = God{"Osiris", "None", "A crook and flail", Mythology::Egyptian};
	Link* egypt_gods{new Link{god_temp, nullptr, nullptr}};

	god_temp = God{"Ra", "The sun", "The power of creation", Mythology::Egyptian};
	egypt_gods = egypt_gods->add_ordered(new Link{god_temp});

	god_temp = God{"Shu", "The wind", "Power to hold up the sky", 
		Mythology::Egyptian};
	egypt_gods = egypt_gods->add_ordered(new Link{god_temp});

	print_all(norse_gods);
	std::cout << '\n';

	print_all(greek_gods);
	std::cout << '\n';

	print_all(egypt_gods);
	std::cout << '\n';
	return 0;
}
开发者ID:dukebw,项目名称:Ch17_PPP2,代码行数:53,代码来源:linked_list.cpp


示例8: main

void main(void) {
	printf("[+] Creating a Linked-list 1~5.\n");
	NodePtr testData = create_list(1,5);
	print_all(testData);
	puts("Let me swap it adjacently! swap(3,4)");
	swap(testData,testData->next->next,testData->next->next->next);
	print_all(testData);
	puts("Let me change between head and tail. swap(1,5)");
	NodePtr tail=testData;
	while(tail->next) tail = tail->next;
	print_all(swap(testData,testData,tail));
}
开发者ID:bittorrent3389,项目名称:interviewCode,代码行数:12,代码来源:linked_list_swap.c


示例9: print_last_n

void print_last_n(LIST* head, int n, FILE* g) {
    int na = list_length(head);
    if (n >= na) {
        print_all(head, g);
    } else {
        LIST* t = head;
        for (int i = 0; i < na - n; i++) {
            t = t->next;
        }
        print_all(t, g);
    }
}
开发者ID:Alecs94,项目名称:DSA-lab,代码行数:12,代码来源:main.c


示例10: print_all

void print_all(struct node obj){
	if(&obj!=NULL){
		if(obj.name=='S'||obj.name=='I'||obj.name=='D'||obj.name=='C'){
			if(obj.prev!=NULL)
				print_all(*obj.prev);
			if(obj.value!=NULL) {
				print_node(obj);
			}
			if(obj.next!=NULL)
				print_all(*obj.next);	
		}
	}
}
开发者ID:adzka95,项目名称:treeIntDoubleCharStack-,代码行数:13,代码来源:main.c


示例11: main

int main()
{
    Link* norse_gods = new Link("Thor");
    norse_gods = norse_gods->insert(new Link("Odin"));
    norse_gods = norse_gods->insert(new Link("Zeus"));
    norse_gods = norse_gods->insert(new Link("Freia"));

    Link* greek_gods = new Link("Hera");
    greek_gods = greek_gods->insert(new Link("Athena"));
    greek_gods = greek_gods->insert(new Link("Mars"));
    greek_gods = greek_gods->insert(new Link("Poseidon"));

    Link* p = greek_gods->find("Mars");
    if (p) p->value = "Ares";

    // Move Zeus into his correct Pantheon:
    {
        Link* p = norse_gods->find("Zeus");
        if (p) {
            if (p==norse_gods)
                norse_gods = p->next();
            p->erase();
            greek_gods = greek_gods->insert(p);
        }
    }

	norse_gods->add(new Link("loki"));
    // Finally, let's print out those lists:

	print_all(norse_gods);
    cout<<"\n";
	norse_gods=norse_gods->advance(2); // test advance
    print_all(norse_gods);
    cout<<"\n";

    print_all(greek_gods);
    cout<<"\n";
	cout<<greek_gods->node_count()<<endl; // test node count

	Link* god_list=new Link("Apollo");
	god_list=god_list->add(new Link("Aphrodite"));
	god_list=god_list->add(new Link("Artemis"));
	god_list=god_list->add(new Link("Hades"));
	god_list=god_list->first();
	print_all(god_list);
	cout<<endl;
	keep_window_open();
}
开发者ID:alanachtenberg,项目名称:CSCE-113,代码行数:48,代码来源:assign2pr2.cpp


示例12: editfile

void editfile (list_ref list, char *filename) {
   char stdinline[1024];
   int stdincount = 0;
   for(;; ++stdincount) {
      printf ("%s: ", Exec_Name);
      char *linepos = fgets (stdinline, sizeof stdinline, stdin);
      if (linepos == NULL) break;
      if (want_echo) printf ("%s", stdinline);
      linepos = strchr (stdinline, '\n');
      if (linepos == NULL || stdinline[0] == '\0') {
         badline (stdincount, stdinline);
      }else {
         *linepos = '\0';
         switch (stdinline[0]) {
            case '$': setmove_list(list, MOVE_LAST, stdinline); break;
            case '*': print_all(list, stdinline); break;
            case '.': viewcurr_list(list, stdinline); break;
            case '0': setmove_list(list, MOVE_HEAD, stdinline); break;
            case '<': setmove_list(list, MOVE_PREV, stdinline); break;
            case '>': setmove_list(list, MOVE_NEXT, stdinline); break;
            case '@': debugdump_list (list, stdinline); break;
            case 'a': insert_line_after (list, stdinline+1); break;
            case 'd': delete_list(list, stdinline); break;
            case 'i': insert_line_before(list, stdinline+1); break;
            case 'r': insertfile(list, stdinline+1); break;
            case 'w': writefile (list, stdinline+1, filename); break;
            default : badline (stdincount, stdinline);
         }
      }
   }
   printf("%s\n", "^D");
}
开发者ID:jwongv,项目名称:cmps012b,代码行数:32,代码来源:edfile.c


示例13: check_count_free_list

/**
 * check_count_free_list -Check for count of free blocks, iterating over blocks 
 *                        and by going through next pointers
 */
static void check_count_free_list() 
{
    void *bp;
    unsigned int counti = 0;
    unsigned int countp = 0;
    /*Iterate over list*/   
    for (bp = heap_listp; GET_SIZE(HDRP(bp)) > 0; bp = NEXT_BLKP(bp)) {
        if(!GET_ALLOC(HDRP(bp))) {
            counti++;
        }
    }
    /* Moving free list by pointers*/
    for (int i = 0; i < NO_OF_LISTS; i++) {
        for (bp = GET_SEGI(seg_list,i); (bp!=NULL) 
          &&  (GET_SIZE(HDRP(bp)) > 0);bp = GET_NEXTP(bp)) {
            countp++;
        }   
    }

    /*If count is not matching, print error, with debug Info*/
    if(countp!=counti) {
        printf("ERROR: No. of free block mismatch\n");
        dbg_printf("free\n");
        print_free();
        dbg_printf("all\n");
        print_all();
    }
}
开发者ID:AceYuRanger,项目名称:MallocLab,代码行数:32,代码来源:mm.c


示例14: commandlist

void commandlist(int command){
  switch(command){
    case 1: case 2: case 3: case 4: case 5:
    case 6: case 7: case 8: case 9:
      print_run(command);
      break;
    case 10:
      recover_run();
      break;
    case 11:
      print_all();
      break;
    case 12:
      win_stats();
      break;
    case 13:
      best_class();
      break;
    case 14:
      worst_class();
      break;
    case 15:
      played_class();
      break;
    case 16:
      myelo();
      break;
    case 21: case 22: case 23: case 24: case 25:
    case 26: case 27: case 28: case 29:
      class_win_stats(command);  
      break;
  }
}
开发者ID:thducng,项目名称:C,代码行数:33,代码来源:HSv3.c


示例15: main

int main(void) {
	int arr[2][4]={1,2,3,4,5,6,7,8};
	int i;
	i=sizeof(arr)/sizeof(*arr);
	print_all(arr,i);
	return 0;
}
开发者ID:ForceRain,项目名称:InsideSoongsil,代码行数:7,代码来源:ex4-1.c


示例16: main

int main()
{
    cout << "Hello, World!\n" ;

    print_all(cout, "Hello", " World", '!', 0 ,'\n');

    ui_history h(1);

    current(h).emplace_back("Hello");
    current(h).emplace_back("World");
    current(h).emplace_back("1");
    current(h).emplace_back("2");
    current(h).emplace_back("3");
    current(h).emplace_back("4");
    current(h).emplace_back("5");
    current(h).emplace_back("6");
    current(h).emplace_back("7");
    current(h).emplace_back("8");
    current(h).emplace_back("9");
    current(h).emplace_back("10");
    current(h).emplace_back(my_class_t());

    current(h).operator[](1).test();
    current(h)[1].test();
    ui_object uio = current(h)[1];
    uio.test();
    auto &uior = current(h)[1];
    uior.test();
??    boost::uuids::uuid ot = uior.get_tag();
开发者ID:MaxFreak,项目名称:operator_forwarding,代码行数:29,代码来源:main.cpp


示例17: main

int main() {

  struct toys mine;
  init(&mine);
  print_all(mine);
  return 0;
}
开发者ID:kizzlebot,项目名称:Computer-Science-I,代码行数:7,代码来源:toys.c


示例18: setlocale

void queue::menu()
{
	FILE* ff;
	char d[60];
	int m = 0;
	setlocale(LC_ALL, "Russian");
	do
	{
		system("CLS");
		if (!fopen_s(&ff, "menu_queue.dpd", "r") == NULL)
		{
			printf_s("Error 2");
		}
		fseek(ff, 0, SEEK_SET);
		while (fgets(d, 59, ff) != NULL)
		{
			printf_s("%s", d);
		}
		fclose(ff);
		scanf_s("%d", &m);
		switch (m)
		{
		case(1) : add_many(); break;
		case(2) : take(); 	 _getch(); break;
		case(3) : print_all(); break;
		default:
			break;
		}
	} while (m);
}
开发者ID:stereo069,项目名称:list2,代码行数:30,代码来源:method.cpp


示例19: main

int main() {
  struct hotel plaza;
  int ans,i;
  init_hotel(&plaza);

  // Asks the user to check out rooms.
  printf("Would you like check in(1), or check out(2) or quit(4)?");
  scanf("%d", &ans);

  // Execute the user's choices until they quit.
  while (ans != 4) {

    if (ans == 1) 
      get_room(&plaza);
    else if (ans == 2)
      check_out(&plaza);
    else if (ans == 3) 
      print_all(&plaza);

    // Get the user's next choice.
    printf("Would you like check in(1), or check out(2) or quit(3)?");
    scanf("%d", &ans);
  }

  return 0;
}
开发者ID:kizzlebot,项目名称:Computer-Science-I,代码行数:26,代码来源:hotel.c


示例20: main

int main(int argc, const char *argv[])
{	
	i = 0;
	int n = 0;
	while ( scanf("%d%c", &op[i].integer , &op[i].operator ) != EOF ) {

		while ( op[i].operator == ' ') {
			scanf("%c", &op[i].operator);
		}
		i++;
		if ( op[i - 1].operator == '=' ) {
			scanf("%s",&var_name);
			if ( n == 0 ) {
				n++;	
			} else {
				printf("\n");	
			}
			print_all();	
			while ( i > 1 ) {
				cal();
			}
			i = 0;
		}
	}
	return 0;
}
开发者ID:shoting,项目名称:onlinejudge,代码行数:26,代码来源:397.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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