⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example_13_2.cpp

📁 data+structures+using+c的源码
💻 CPP
字号:

#include <iostream> 
#include <utility> 
#include <string>  
using namespace std;  

void funcExp(pair<int, int>); 
void funcExp1(pair<int, char>);
void funcExp2(pair<int, string> x);
void funcExp3(pair<int, char *> x);

int main()
{
    pair<int, double> x(50,87.67);						//Line 1
    pair<string, string> name("John","Johnson");		//Line 2

    cout<<"Line 3: "<<x.first<<" "<<x.second<<endl;		//Line 3
    cout<<"Line 4: "<<name.first<<" "<<name.second
		<<endl; 										//Line 4	

    pair<int, int> y;									//Line 5
    cout<<"Line 6: "<<y.first<<" "<<y.second<<endl;		//Line 6

    pair<string, string> name2;							//Line 7
    cout<<"Line 8: "<<name2.first<<"***"
		<<name2.second<<endl;							//Line 8 
    funcExp(make_pair(75,80));							//Line 9
    funcExp1(make_pair(87,'H'));						//Line 10
    funcExp1(pair<int, char>(198,'K'));					//Line 11
    funcExp2(pair<int, string>(250,"Hello"));			//Line 12
    funcExp2(make_pair(65,string("Hello There")));		//Line 13
    funcExp3(pair<int, char *>(35, "Hello World"));		//Line 14
    funcExp3(make_pair(22, (char *)("Sunny")));			//Line 15

   return 0;											//Line 16
}

void funcExp(pair<int, int> x)
{
	cout<<"Line 17: "<<"In funcExp: "<<x.first
     <<" "<<x.second<<endl;								//Line 17
}  

void funcExp1(pair<int, char> x) 
{ 	cout<<"Line 18: "<<"In funcExp1: "<<x.first
          <<" "<<x.second<<endl;						//Line 18 
}  

void funcExp2(pair<int, string> x)
{
	cout<<"Line 19: "<<"In funcExp2: "<<x.first
          <<" "<<x.second<<endl;				 //Line 19 
}  
void funcExp3(pair<int, char *> x) 
{ 	
	cout<<"Line 20: "<<"In funcExp3: "<<x.first
		<<" "<<x.second<<endl;				  //Line 20 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -