C++分析研究  
C++
日历
<2013年8月>
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567
统计
  • 随笔 - 92
  • 文章 - 4
  • 评论 - 4
  • 引用 - 0

导航

常用链接

留言簿

随笔档案

文章档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜

 
  //pair:对组,可以将两个值(first,second)视为一个单元(pair),是个模板类。对于map/multimap,就是用pairs来管理value/key的成对元素。任何函数需要回传两个值,也需要pair
 
   #include
 
   #include
 
   #include
 
   #include
 
   using namespace std;
 
   void test0()
 
   {
 
   pair product1("tomatoes",3.25);//定义一个组单元
 
   pair product2;
 
   pair product3;
 
   product2.first="lightbulbs";
 
   product2.second=0.99;//设置pair的first,second数据雅思改分
 
   product3=make_pair("shoes",20.0);//make_pair是个模板函数,返回pair
 
   cout<<"the price of "<
 
   cout<<"the price of "<
 
   cout<<"the price of "<
 
   }
 
   void Test(char h)
 
   {
 
   cout<<"press key===="<
 
   switch(h)
 
   {
 
   case '0': test0();break;
 
   case 27:
 
   case 'q':exit(0);break;
 
   default:cout<<"default "<
 
   }
 
   }
 
   void main()
 
   {
 
   while(1)
 
   {
 
   Test(getch());
 
   }
 
   }
 
posted on 2013-06-18 09:55 HAOSOLA 阅读(232) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


 
Copyright © HAOSOLA Powered by: 博客园 模板提供:沪江博客
PK10开奖 PK10开奖