49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
|
#include <iostream>
|
|||
|
#include <vector> //<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>
|
|||
|
#include <numeric>
|
|||
|
#include <string>
|
|||
|
|
|||
|
using std::cin;
|
|||
|
using std::endl;
|
|||
|
using std::cout;
|
|||
|
using std::vector;
|
|||
|
using std::accumulate; //accumulate()<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>ص<EFBFBD><D8B5>ۻ<EFBFBD>ֵ
|
|||
|
using std::string;
|
|||
|
|
|||
|
int main(int argc, const char* argv[]) {
|
|||
|
vector<string> v = { "zhang", "meng", "nan" , "1220310013"};
|
|||
|
string str; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
|||
|
str = accumulate(v.begin(), v.end(), str); //<2F><>v<EFBFBD><76><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>str<74><72>
|
|||
|
cout << str;
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#include <iostream> // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#include <vector> // <20><><EFBFBD>붯̬<EBB6AF><CCAC><EFBFBD>飨vector<6F><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#include <numeric> // <20><><EFBFBD><EFBFBD>numeric<69>⣬<EFBFBD>ṩaccumulate<74><65><EFBFBD><EFBFBD>
|
|||
|
#include <string> // <20><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
using std::cin;
|
|||
|
using std::endl;
|
|||
|
using std::cout;
|
|||
|
using std::vector;
|
|||
|
using std::accumulate; // <20><><EFBFBD><EFBFBD>accumulate<74><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>Ԫ<EFBFBD><D4AA>
|
|||
|
using std::string;
|
|||
|
|
|||
|
int main(int argc, const char* argv[]) {
|
|||
|
// <20><>ʼ<EFBFBD><CABC>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
vector<string> v = { "zhang", "meng", "nan", "1220310013" };
|
|||
|
|
|||
|
string str; // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ洢<DAB4>ۻ<EFBFBD><DBBB>Ľ<EFBFBD><C4BD><EFBFBD>
|
|||
|
|
|||
|
// ʹ<><CAB9>accumulate<74><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>vector v<>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// accumulate<74>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۻ<EFBFBD><DBBB>ij<EFBFBD>ʼֵ<CABC><D6B5><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>str<74><72><EFBFBD>ڿ<EFBFBD>ʼ<EFBFBD>ۻ<EFBFBD>
|
|||
|
str = accumulate(v.begin(), v.end(), str);
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ۻ<EFBFBD><DBBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
|||
|
cout << str; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"zhangmengnan1220310013"
|
|||
|
|
|||
|
return 0; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|