函数,特殊语法
pfeiKing
安安静静地先稳住
展开
-
scanf,cout
//scanf和cout的格式 //printf("%5d",a);右对齐五个宽度 //printf("%05d",a);右对齐0填充 #include #include #include #include using namespace std; int n; double d; void Input() { int t,mark; int sum; while(~scanf("%d"原创 2015-10-23 10:50:15 · 514 阅读 · 0 评论 -
C++杂七杂八
CLOCK &FunC(形参);返回值是CLOCK类的引用 非类的成员函数,不用加const在末尾 " #include using namespace std; class Complex { public: Complex(double r=0.0,double i=0.0):real(r),imag(i){} friend Complex operator+(const原创 2018-01-15 10:32:28 · 258 阅读 · 0 评论 -
getline函数
对于cin遇到空格就要等到下一次才能输入了。因此需要使用getline getline(cin,str,',');//','是分隔符,即在输入过程中遇到','就会停止输入。 例如 getline(cin,str,' '); 键入aaa bbb ccc而str中只存入了aaa 键入aaa,bb,cc dd那么str中存入了aaa,bb,cc getline(cin,str,',');原创 2018-01-08 11:14:12 · 1498 阅读 · 0 评论