上一页 1 ··· 20 21 22 23 24
  2023年4月18日
摘要: 7-1 用虚函数分别计算各种图形的面积 分数 20 全屏浏览题目 切换布局 作者 沙金 单位 石家庄铁道大学 定义抽象基类Shape,由它派生出五个派生类:Circle(圆形)、Square(正方形)、Rectangle( 长方形)、Trapezoid (梯形)和Triangle (三角形),用虚函 阅读全文
posted @ 2023-04-18 23:21 清荣峻茂 阅读(62) 评论(0) 推荐(0)
  2023年4月17日
摘要: 现在要开发一个系统,管理对多种汽车的收费工作。给出下面的一个基类框架 class Vehicle { protected: string NO; public: Vehicle(string n){ NO = n; } virtual int fee()=0;//计算应收费用 }; 以Vehicle 阅读全文
posted @ 2023-04-17 23:14 清荣峻茂 阅读(48) 评论(0) 推荐(0)
  2023年4月15日
摘要: 计算n的阶乘 #include<iostream>using namespace std;unsigned fac(unsigned n){ unsigned f; if (n==0) f=1; else { f=fac(n-1)*n; } return f;} int main() { unsig 阅读全文
posted @ 2023-04-15 23:26 清荣峻茂 阅读(22) 评论(0) 推荐(0)
  2023年4月14日
摘要: 编写x的n次方函数 #include<iostream>using namespace std;double power(double x,int n){ double a=1.0; while(n--) a*=x; return a;}int main(){ double x; int n; ci 阅读全文
posted @ 2023-04-14 22:26 清荣峻茂 阅读(18) 评论(0) 推荐(0)
  2023年4月13日
摘要: 1、输入一个整数,将其顺序反转后输出 (do while语句) #include<iostream>using namespace std;int main(){ int n,s; cin>>n; do{ s=n%10; //取末尾数字 cout<<s; n=n/10; //将原数的末尾数字割除 } 阅读全文
posted @ 2023-04-13 20:22 清荣峻茂 阅读(32) 评论(0) 推荐(0)
  2023年4月12日
摘要: 钟表类 #include<iostream>using namespace std;class clock{public:clock(int h,int m,int s);clock();void settime(int h,int m,int s);void showtime();private: 阅读全文
posted @ 2023-04-12 20:12 清荣峻茂 阅读(26) 评论(0) 推荐(0)
  2023年4月11日
摘要: 判断某年是否是闰年问题 #include<iostream>using namespace std;int main(){ int year;cout<<"Enter the year:";cin>>year;bool isaleapyear;isaleapyear=((year%4==0&&yea 阅读全文
posted @ 2023-04-11 20:16 清荣峻茂 阅读(15) 评论(0) 推荐(0)
上一页 1 ··· 20 21 22 23 24