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

📄 f0515.cpp

📁 it is a usefull thing
💻 CPP
字号:
//=====================================
// f0515.cpp
// 别扭的参数默认
//=====================================
#include<iostream>
#include<vector>
using namespace std;
//-------------------------------------
vector<int> b(10, 0);
void print(const vector<int>& a = b);
bool process(vector<int>& a);
//-------------------------------------
int main(){
  vector<int> a(10, 5);
  if(process(a))  print(a);
  else            print();
}//------------------------------------
void print(const vector<int>& a){
  if(a==vector<int>(10, 0)){
    cout<<"failed.\n";
    return;
  }
  for(int i=0; i<a.size(); ++i)
    cout<<a[i]<<" ";
  cout<<"\n";
}//------------------------------------
bool process(vector<int>& a){
  int sum = 0;
  for(int i=0; i<a.size(); ++i) sum += a[i];
  if(sum>100) return true;
  else return false;
}//====================================

 

⌨️ 快捷键说明

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