随笔分类 - C++
摘要:#include<iostream>#include<cmath>using namespace std;class Point{ private: double x; double y; double z; public: Point(double a,double b,double c):x(a
阅读全文
摘要:#include<iostream>using namespace std;class Horse{ public: Horse(){ cout<<"Horse 申请了空间..."<<endl; } virtual void Fly(){ cout<<"Just a horse."<<endl; }
阅读全文
摘要:#include <iostream>#include <iomanip>using namespace std;class Shape{ public: const double PI; Shape():PI(3.1415926){ } virtual double Area()=0;};clas
阅读全文
摘要:#include<iostream>#include<cmath>#include<stdexcept>using namespace std;double area(double a,double b,double c) throw (invalid_argument){ if(a<=0||b<=
阅读全文
摘要:#include<iostream>#include<string>using namespace std;class MyException{ public: MyException(const string &message):message(message){} ~MyException(){
阅读全文
摘要:#include<iostream>#include<algorithm>#include<functional>#include<vector>using namespace std;int main(){ int iarray[]={26,17,15,22,23,33,32,40}; vecto
阅读全文
摘要:#include<iostream>#include<algorithm>#include<functional>#include<iterator>#include<vector>using namespace std;class evenByTwo{ private: int x; public
阅读全文
摘要:#include<iostream>#include<algorithm>#include<functional>#include<vector>using namespace std;int main(){ int iarray[]={0,1,2,3,4,5,6,6,6,7,8}; vector<
阅读全文
摘要:#include<fstream>#include<iostream>using namespace std;int main(int){ ifstream inf; inf.open("abc.txt"); ofstream outf; outf.open("abc_back.txt"); cha
阅读全文
摘要:#include<iostream>using namespace std;int main(){ int n; cout<<"Input n: "; cin>>n; cout<<"Dec: "<<dec<<n; cout<<" "<<"Oct: "<<oct<<n; cout<<" "<<"Hex
阅读全文
摘要:#include<iostream>#include<fstream>using namespace std;class Dog{ public: int gdoga() { return a; } int gdogw() { return w; } void setdog(int x,int y)
阅读全文
摘要:#include <iostream>#include <iomanip>using namespace std;class matrix{private: int row,column; int **mat;public: matrix(const matrix& mx){ this->row=m
阅读全文
摘要:#include<iostream>using namespace std;class Time{ private: int hour; int minute; public: Time(int h=00,int m=00){ hour=h; minute=m; } int friend opera
阅读全文
摘要:#include<iostream>using namespace std;class FS{ private: int fz; int fm; public: FS() { fm=1; fz=0; } void set(int m,int z) { fm=m; fz=z; } void del()
阅读全文
摘要:#include<iostream>#include<string>using namespace std;int main(){ string line; cout<<"Type a line terminated by 't'"<<endl; getline(cin,line,'t'); cou
阅读全文
摘要:#include<iostream>#include<fstream>using namespace std;int main(){ ifstream file("integers",ios_base::in | ios_base::binary); if(file){ while (file){
阅读全文
摘要:#include<iostream>#include<sstream>#include<string>using namespace std;template<class T>inline T fromString(const string &str){ istringstream is(str);
阅读全文
摘要:#include<iostream>#include<fstream>using namespace std;int main(){ int values[]={3,7,0,5,4}; ofstream os("integers",ios_base::out | ios_base::binary);
阅读全文
摘要:#include<iostream>#include<fstream>#include<cstring>using namespace std;struct SalaryInfo{ unsigned id; double salary;};int main(){ SalaryInfo employe
阅读全文
摘要:#include<iostream>using namespace std;int main(){ char ch; while((ch=cin.get()) !=EOF) cout.put(ch); return 0;}
阅读全文