-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cpp
74 lines (70 loc) · 1.52 KB
/
Main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include<bits/stdc++.h>
using namespace std;
// #define T int
template<class T> //as like as micross
class data
{
public:
T a,b,c;
data(){}
data(T a,T b,T c){
this-> a = a;
this-> b = b;
this-> c = c;
}
bool operator<(data other)const{
return a < other.a;
}
friend void operator<<(ostream &cout,data &d){
cout<<d.a<<" "<<d.b<<" "<<d.c<<"\n";
}
};
template <class T>
void operator<<(ostream &cout,vector<T> d){
cout<<"[";
for(auto x: d) cout<<x<<", ";
cout<<"]\n";
}
template <class T>
void operator<<(ostream &out,pair<T,T> &d){
out<<"{ "<<d.first<<" , "<<d.second<<" }\n";
}
// ---------- parameter pack && flod expression ---------
int multi(){
return 0;
}
template<typename T,typename...V>
int multi(T t,V... v){
// static const std::size_t index = sizeof...(V);
// cout<<index<<'\n';
return t*multi(v...);
}
template<typename...Args> // c++17 or earliar version
auto foldMulti(Args... args){
return (args*...*1);
}
void solve(){
data<float> d1(0.4,0.9,0.99);
data<int> d2(10,20,30);
cout<<d1;
cout<<d2;
vector<int> arr={1,2,3,4,5,6,7,8,9,10};
cout<<arr;
pair<int,int> p = {9,2};
cout<<p;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
#endif
int tt=1;
// cin>>tt;
for(int i=1; i<=tt; i++){
// cout<<"Case "<<i<<":\n";
solve();
}
return 0;
}