2023年5月14日

天梯赛-个位数统计

摘要: #include<stdio.h> int main(){ int count[10]={0}; char a; while((a=getchar())!='\n') { count[a-'0']++; } for(int i=0;i<10;i++) { if(count[i]!=0) { prin 阅读全文

posted @ 2023-05-14 13:07 涵宝666 阅读(40) 评论(0) 推荐(0)

2023年5月4日

有序数组(类模板)

摘要: template <class T>class MyArray{ public: bool check(); MyArray(int size) { this->size=size; data = new T[size]; for(int i=0;i<size;i++) cin>>data[i]; 阅读全文

posted @ 2023-05-04 23:50 涵宝666 阅读(51) 评论(0) 推荐(0)

2023年4月25日

打印上下三角形

摘要: #include<iostream>using namespace std;int main(){ int n; while(cin>>n){ for(int i=1;i<=n;i++) { for(int j=1;j<=n-i;j++) { cout<<" "; } for(int j=1;j<= 阅读全文

posted @ 2023-04-25 23:22 涵宝666 阅读(26) 评论(0) 推荐(0)

2023年4月22日

天梯赛—连续因子

摘要: 天梯赛—连续因子 . #include<stdio.h>#include<math.h>int main(){ long long int N, i, j, num, count, start = 0, max = 0; scanf("%lld", &N); for (i = 2; i < sqrt(N); i++) 阅读全文

posted @ 2023-04-22 00:00 涵宝666 阅读(33) 评论(0) 推荐(0)

2023年4月18日

C++多态(抽象基类派生三个类)

摘要: C++多态(抽象基类派生三个类) #include<iostream>#include<math.h>using namespace std;#define PI 3.1415926//宏定义圆周率class Shape{ };//定义一个抽象类class Circle:public Shape{ double R; public: 阅读全文

posted @ 2023-04-18 23:57 涵宝666 阅读(39) 评论(0) 推荐(0)

C++ 多态——无规矩不成方圆

摘要: C++ 多态——无规矩不成方圆 class Shape{ public:Shape(){ //public里的Shape构造函数可以没有参数(根据题的意思) } virtual ~Shape(){} virtual float area()=0;};class Circle:public Shape{ public: ~Circl 阅读全文

posted @ 2023-04-18 00:27 涵宝666 阅读(207) 评论(0) 推荐(0)

导航