简历投递一天

This commit is contained in:
Estom
2021-08-23 22:53:15 +08:00
parent 4ed6ee6517
commit fb01b19088
7 changed files with 304 additions and 13 deletions

View File

@@ -0,0 +1,37 @@
#include<iostream>
#include<vector>
using namespace std;
// 重载运算符。返回流本身,用于链式法则。如果需要访问私有变量
// 需要声明为友元。一般不需要声明为友元。
ostream & operator<<(ostream &os, const vector<int> temp)
{
for(auto a : temp){
os<<a<<" ";
}
os<<endl;
return os;
}
int main(){
vector<int> arr{-1, 3, -3, 4,5};
cout<<arr<<endl;
vector<int> temp(arr.size()+1,0);
for(int i=0;i<arr.size();i++){
if(arr[i]<arr.size()+1 && arr[i]>0){
temp[arr[i]]=1;
}
}
int i;
for(i=1;i<temp.size();i++){
if(temp[i]==0)break;
}
cout<<i<<endl;
return 0;
}
// 测试一下友元