04 2023 档案

摘要:class Circle : public Plane,public Point {public: Circle(double x = 0, double y = 0, double r = 0) : Point(x,y), radius(r) { cout<<"Circle Constructor 阅读全文
posted @ 2023-04-30 18:25 jmhyyds 阅读(23) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;int main(){ int i; int r1=1,r; int r2=1; for(i=3;i<=30;i++) { r=r1+r2; r2=r1; r1=r; }cout<<r; return 0; } 阅读全文
posted @ 2023-04-25 08:46 jmhyyds 阅读(23) 评论(0) 推荐(0) 编辑
摘要:设计并实现加法器类Adder Adder类的数据成员包括:①私有数据成员:数值域num(int型)。Adder类成员函数包括:①有参构造函数Adder(int)和拷贝构造函数Adder(const Adder &),其中有参构造函数参数默认值为0,输出信息“Adder Constructor run 阅读全文
posted @ 2023-04-24 21:26 jmhyyds 阅读(70) 评论(0) 推荐(0) 编辑
摘要:函数重载是指在同一作用域内,可以有一组具有相同函数名,不同参数列表的函数,这组函数被称为重载函数。重载函数通常用来命名一组功能相似的函数,这样做减少了函数名的数量,避免了名字空间的污染,对于程序的可读性有很大的好处。 #include<iostream> using namespace std; v 阅读全文
posted @ 2023-04-21 17:46 jmhyyds 阅读(98) 评论(0) 推荐(0) 编辑
摘要:下面3个写法,出现在形参列表中都是等价的。void f(int p[]);void f(int p[3]);void f(int *p); 设有一个int型数组 a,有10个元素。用3种方法输出各元素 程序1:使用数组名和下标。#include<iostream>using namespace st 阅读全文
posted @ 2023-04-20 21:53 jmhyyds 阅读(24) 评论(0) 推荐(0) 编辑
摘要:include <iostream>#include <cmath> using namespace std;int main(){ int j,k,s; for(j=0;j<=9;j++) { for(k=0;k<=9;k++) { if(j!=k){ s=1000*j+100*j+10*k+k; 阅读全文
posted @ 2023-04-19 12:33 jmhyyds 阅读(16) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h>typedef struct{ int year; int month; int day;}DATE;int countday(DATE today);int runyear(int year);int main(){ DATE today; int totalda 阅读全文
posted @ 2023-04-18 12:37 jmhyyds 阅读(15) 评论(0) 推荐(0) 编辑
摘要:using namespace std; class Base {public: virtual void tall();}; class People : Base {public: void tall() { cout << "people" << endl; };}; 在 main 方法中,我 阅读全文
posted @ 2023-04-17 21:36 jmhyyds 阅读(5) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>using namespace std;int f(int a[]){ int i,f=0; for(i=0;i<=9;i++){ if(a[0]!=a[i]) f=1; }return f; }int main(){ int a[10]={10,2,8,22, 阅读全文
posted @ 2023-04-16 20:37 jmhyyds 阅读(12) 评论(0) 推荐(0) 编辑
摘要:源码: #include<iostream>using namespace std;int main(){ int a,b,c,count=0; for(a=1;a<=5;a++){for(b=1;b<=5;b++) { for(c=1;c<=5;c++) { if(a!=b&&a!=c&&b!=c 阅读全文
posted @ 2023-04-15 11:48 jmhyyds 阅读(17) 评论(0) 推荐(0) 编辑
摘要:源码: #include <iostream>using namespace std;int main(){ int m,g,x;//m:母鸡,g:公鸡,x:小鸡; for(m=0;m<=33;m++) { for(g=0;g<=20;g++) { for(x=0;x<100;x++) { if(x 阅读全文
posted @ 2023-04-14 20:12 jmhyyds 阅读(30) 评论(0) 推荐(0) 编辑

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