摘要: #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的小袁 阅读(13) 评论(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的小袁 阅读(24) 评论(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的小袁 阅读(18) 评论(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的小袁 阅读(12) 评论(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的小袁 阅读(14) 评论(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的小袁 阅读(15) 评论(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的小袁 阅读(14) 评论(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的小袁 阅读(14) 评论(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的小袁 阅读(25) 评论(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的小袁 阅读(15) 评论(0) 推荐(0)