随笔分类 -  c++学习

摘要:1 #include<std_lib_facilities.h> 2 int main() 3 { 4 int n; 5 cin>>n; 6 /*if (cin.fail()) 7 cin.clear();*/ 8 if(!cin) 9 cout<<"asf";10 system("pause");11 }12 clear()will chang the condition ofstream to good().This part of date's input and output are as follow 阅读全文
posted @ 2012-03-10 19:03 windynightst 阅读(213) 评论(0) 推荐(0)
摘要:1 #include<iostream> 2 #include"std_lib_facilities.h" 3 using namespace std; 4 class practice 5 { 6 public: 7 practice& a(char m) 8 { 9 cout<<m;10 return *this;11 }12 practice& b(char n)13 {14 cout<<n;15 return *this;16 }17 private:18 char... 阅读全文
posted @ 2012-02-06 16:30 windynightst 阅读(344) 评论(0) 推荐(0)
摘要:#include<iostream>#include<iterator>#include<std_lib_facilities.h>int main(){ vector<int>aa; int a; while(cin>>a) { aa.push_back(a); } vector<int>::iterator it=aa.begin(); aa.erase(it); for( vector<int>::size_type i=0;i<aa.size();i++) { cout<<aa[i]& 阅读全文
posted @ 2012-02-03 13:26 windynightst 阅读(118) 评论(0) 推荐(0)
摘要:以下是我自己做的习题代码:#include"std_lib_facilities.h"vector<int> first;void f1(vector<int> first){ for(int i=0;i<(first.size()/2);i++) { swap(first[i],first[first.size()-1-i]); } for(int i=0;i<first.size();i++) cout<<first[i]<<" ";}int main(){ int firstt; whil 阅读全文
posted @ 2012-01-19 23:41 windynightst 阅读(226) 评论(0) 推荐(0)