04 2023 档案

摘要:#include<stack>#include<iostream>#include<string>using namespace std;int main(){ stack<char>s; string str; cin>>str; for(auto iter=str.begin();iter != 阅读全文
posted @ 2023-04-27 20:22 不会JAVA的小袁 阅读(12) 评论(0) 推荐(0) 编辑
摘要:#include<list>#include<iterator>#include<string>#include<iostream>using namespace std;int main(){ string names1[]={"Alice","Helen","Lucy","Susan"}; st 阅读全文
posted @ 2023-04-27 20:15 不会JAVA的小袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include<vector>#include<deque>#include<algorithm>#include<iterator>#include<iostream>using namespace std;int main(){ istream_iterator<int>i1(cin),i2; 阅读全文
posted @ 2023-04-27 19:35 不会JAVA的小袁 阅读(15) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<list>#include<deque>using namespace std;template<class T>void printContainer(const char* msg,const T& s){ cout<<msg<<":"; c 阅读全文
posted @ 2023-04-26 21:18 不会JAVA的小袁 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include<algorithm>#include<iterator>#include<vector>#include<iostream>using namespace std;template<class T,class InputIt,class OutputIt>void mySort(I 阅读全文
posted @ 2023-04-26 20:51 不会JAVA的小袁 阅读(13) 评论(0) 推荐(0) 编辑
摘要:#include<iterator>#include<iostream>#include<algorithm>using namespace std;double square(double x){ return x*x;}int main(){ transform(istream_iterator 阅读全文
posted @ 2023-04-25 19:00 不会JAVA的小袁 阅读(8) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<vector>#include<iterator>#include<algorithm>#include<functional>using namespace std;int main(){ const int N=5; vector<int>s 阅读全文
posted @ 2023-04-25 18:53 不会JAVA的小袁 阅读(12) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<cstdlib>using namespace std;struct Student{ int id; float gpa;};template<class T>class Store{ private: T item; bool haveVal 阅读全文
posted @ 2023-04-25 18:39 不会JAVA的小袁 阅读(14) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;template<class T>void outputArray(const T *array,int count){ for(int i=0;i<count;i++) cout<<array[i]<<" "; cout< 阅读全文
posted @ 2023-04-25 18:20 不会JAVA的小袁 阅读(9) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<iomanip>#include<string>using namespace std;struct Student{ int num; string name; char sex; int age;};int main(){ Student s 阅读全文
posted @ 2023-04-24 11:59 不会JAVA的小袁 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include<string>#include<iostream>using namespace std;class ExamInfo{ public: ExamInfo(string name,char grade) :name(name),mode(GRADE),grade(grade){} 阅读全文
posted @ 2023-04-24 11:43 不会JAVA的小袁 阅读(19) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;enum GameResult {WIN,LOSE,TIE,CANCEL};int main(){ GameResult result; enum GameResult omit=CANCEL; for (int count 阅读全文
posted @ 2023-04-24 11:28 不会JAVA的小袁 阅读(14) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Animal{ public: int a,b; virtual void speak() { cout<<"My name is Animal."<<endl; }};class Cat:public Anim 阅读全文
posted @ 2023-04-22 21:46 不会JAVA的小袁 阅读(8) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class People{ protected: int age; string name; public: People(){}; People(int a,string n){ age=a; name=n; } ~Peo 阅读全文
posted @ 2023-04-22 21:37 不会JAVA的小袁 阅读(12) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#define PI 3.14using namespace std;class Shape{ public: Shape(){ cout<<"shape构造"<<endl; } virtual double getArea()=0; virtual double 阅读全文
posted @ 2023-04-21 20:24 不会JAVA的小袁 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Point{ public: Point(){ x=0; y=0; } Point(float x1,float y1){ x=x1; y=y1; } friend Point operator+(const P 阅读全文
posted @ 2023-04-21 19:54 不会JAVA的小袁 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class BaseClass{ public: BaseClass(){ cout<<"construct BaseClass"<<endl; } ~BaseClass(){ cout<<"destruct BaseCla 阅读全文
posted @ 2023-04-21 19:35 不会JAVA的小袁 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class BaseClass { public: virtual void fn1() const{ cout<<"BaseClass:fn1()"<<endl; } void fn2() const{ cout<<"Ba 阅读全文
posted @ 2023-04-20 13:59 不会JAVA的小袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Mammal{ public: virtual void speak() const=0;};class Dog:public Mammal{ public: virtual void speak() const 阅读全文
posted @ 2023-04-20 13:45 不会JAVA的小袁 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Counter{ public: Counter(int c):count(c){} int operator +(Counter &c2); private: int count;};int Counter:: 阅读全文
posted @ 2023-04-20 13:38 不会JAVA的小袁 阅读(12) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<typeinfo>using namespace std;class Base{ public: virtual ~Base() {}};class Derived:public Base{};void fun(Base *b){ const t 阅读全文
posted @ 2023-04-20 13:30 不会JAVA的小袁 阅读(13) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base{ public: virtual void fun1() { cout <<"Base::fun1()"<<endl; } virtual ~Base() {}};class Derived1:publ 阅读全文
posted @ 2023-04-20 13:21 不会JAVA的小袁 阅读(8) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base1{ public: virtual void display() const=0;};class Base2:public Base1{ public: void display() const;};v 阅读全文
posted @ 2023-04-19 14:24 不会JAVA的小袁 阅读(13) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base{ public: ~Base();};Base::~Base() { cout<<"Base destructor"<<endl;}class Derived:public Base{ public: 阅读全文
posted @ 2023-04-19 14:11 不会JAVA的小袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base1{ public: virtual void display() const;};void Base1::display() const{ cout<<"Base1::display()"<<endl; 阅读全文
posted @ 2023-04-19 13:55 不会JAVA的小袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Complex{ public: Complex(double r=0.0,double i=0.0):real(r),imag(i) {} friend Complex operator+(const Comp 阅读全文
posted @ 2023-04-19 13:42 不会JAVA的小袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Clock{ public: Clock(int hour=0,int minute=0,int second=0); void showTime() const; Clock& operator++(); Cl 阅读全文
posted @ 2023-04-18 13:26 不会JAVA的小袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Complex{ public: Complex(double r=0.0,double i=0.0):real(r),imag(i) {} Complex operator+(const Complex &c2 阅读全文
posted @ 2023-04-18 13:03 不会JAVA的小袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;enum Level1{FRESHMAN,SOPHOMORE,JUNIOR,SENIOR};enum Grade{A,B,C,D};class Student{ public: Student(unsigned number 阅读全文
posted @ 2023-04-17 13:08 不会JAVA的小袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<string>using namespace std;int main(){ for(int i=0;i<2;i++) { string city,state; getline(cin,city,','); getline(cin,state); 阅读全文
posted @ 2023-04-17 12:43 不会JAVA的小袁 阅读(9) 评论(0) 推荐(0) 编辑
摘要:#include<string>#include<iostream>using namespace std;inline void test(const char *title,bool value){ cout<<title<<"returns"<<(value?"true":"false")<< 阅读全文
posted @ 2023-04-17 12:37 不会JAVA的小袁 阅读(12) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;int main(){ int Line1[]={1,0,0}; int Line2[]={0,1,0}; int Line3[]={0,0,1}; int *pLine[3]={line1,line2,line3}; co 阅读全文
posted @ 2023-04-16 20:57 不会JAVA的小袁 阅读(6) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;void rowSum(int a[][4],int nRow){ for(int i=0;i<nRow;i++){ for(int j=1;j<4;j++) a[i][0]+=a[i][j]; }}int main(){ 阅读全文
posted @ 2023-04-16 20:44 不会JAVA的小袁 阅读(9) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;int main(){ int a[10],b[10]; for(int i=0;i<0;i++){ a[i]=i*2-1; b[10-i-1]=a[i]; } for(const auto &e:a) cout<<e<<" 阅读全文
posted @ 2023-04-16 20:32 不会JAVA的小袁 阅读(5) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<cmath>using namespace std;class Point{ public: Point(int x=0,int y=0):x(x),y(y){} int getX(){return x; } int getY({retuen y 阅读全文
posted @ 2023-04-16 20:21 不会JAVA的小袁 阅读(6) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class A{ public: A(int i); void print(); private: const int a; static const int b;};const intA::b=10;A::A(int i) 阅读全文
posted @ 2023-04-16 20:10 不会JAVA的小袁 阅读(7) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> using namespace std; class Dog { public: void setdata() { cin >> name >> age >> sex >> weight; } void GetName() { cout << "它的名字叫" 阅读全文
posted @ 2023-04-15 18:55 不会JAVA的小袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Time{ friend ostream& operator<<(ostream& cout, Time& t); friend istream& operator>>(istream& cin, Time& t 阅读全文
posted @ 2023-04-15 18:37 不会JAVA的小袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std; class Base{ public: void fn1(){ cout<<"Base fn1开始"<<endl; } void fn2(){ cout<<"Base fn2开始"<<endl; }};class Deri 阅读全文
posted @ 2023-04-14 22:01 不会JAVA的小袁 阅读(12) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<stdlib.h>using namespace std;class Object{ public: Object() { cout<<"Object构造函数"<<endl; weight=0; } ~Object() { cout<<"Obje 阅读全文
posted @ 2023-04-14 21:48 不会JAVA的小袁 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base{ public: Base(){}; void fn1()const{ cout<<"调用fn1"<<endl; } void fn2()const{ cout<<"调用fn2"<<endl; }};c 阅读全文
posted @ 2023-04-14 21:31 不会JAVA的小袁 阅读(6) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<string>using namespace std;class Document{ public: Document(){ cin>>name; } void Display()const{ cout<<"Name:"<<name<<endl; 阅读全文
posted @ 2023-04-14 21:13 不会JAVA的小袁 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>using namespace std;class Mammal{ public: Mammal(){ cout<<"Mammal构造"<<endl; } ~Mammal(){ cout<<"析构Mammal"<<endl; }}; class Dog:publ 阅读全文
posted @ 2023-04-13 21:30 不会JAVA的小袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>#define pi 3.14using namespace std; class Shape{public: virtual float getArea(){return 0;} virtual ~Shape(){}};class Rectangle:publ 阅读全文
posted @ 2023-04-13 21:25 不会JAVA的小袁 阅读(13) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base0{ public: int var0; void fun0(){ cout<<"Member of Base0"<<endl; }};class Base1:virtual public Base0{ 阅读全文
posted @ 2023-04-13 21:03 不会JAVA的小袁 阅读(12) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base0{ public: int var0; void fun0(){ cout<<"Member of Base0"<<endl; }};class Base1:public Base0{ public: 阅读全文
posted @ 2023-04-12 21:54 不会JAVA的小袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base1{ public: int var; void fun() { cout<<"Membber of Base1"<<endl; } };class Base2{ public: int var; voi 阅读全文
posted @ 2023-04-12 21:43 不会JAVA的小袁 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base1{ public: Base1(int i){ cout<<"Constructing Base1"<<i<<endl; } Base1(){ cout<<"Constructing Base1"<<e 阅读全文
posted @ 2023-04-12 21:26 不会JAVA的小袁 阅读(13) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base1{ public: Base1(int i){ cout<<"Constructing Base1"<<i<<endl; }};class Base2{ public: Base2(int j){ co 阅读全文
posted @ 2023-04-12 21:15 不会JAVA的小袁 阅读(13) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;int main(){ int x,y; cout<<"Enter x and y:"; cin>>x>>y; if(x!=y) if(x>y) cout<<"x>y"<<endl; else cout<<"x<y"<<en 阅读全文
posted @ 2023-04-10 20:53 不会JAVA的小袁 阅读(17) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;int main(){ int year; bool isLeapYear; cout<<"Enter the year:"; cin>>year; isLeapYear=((year% 4==0&&year% 100!=0 阅读全文
posted @ 2023-04-10 20:38 不会JAVA的小袁 阅读(13) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示