头文件
#include< iostream >
#include< fstream >
#include< sstream>
#include<stdio.h>
#include< string>
#include< cmath>
#include< alogrithm>
#include< cstdlib>
#include< iomanip>
using namespace std;
字符串格式化
#include< iomanip >
精确到小数点后两位:cout<<fixed<<setprecision(2)<<x<<endl;
设置填充字符和宽度:cout<<setw(2)<<setfill(‘0’)<<x<<endl;
sort()函数
#include< algorithm >
比较函数
bool comp(int a,int b){
return a>b;
}
bool Less(const Student& s1, const Student& s2)
{
return s1.name < s2.name; //从小到大排序
}
抛出异常
//抛出异常
throw NegativeNumberExce