自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 C++第11周上机题——派生与继承之联想电脑

1、定义一个电脑 Computer 类, 一个成员变量:m_name 两个成员函数:setName(string name)、getName()2、定义一个联想电脑类:LenovoComputer 一个成员变量:m_price 三个成员函数:setPrice(string price)、getPrice()、printInfo()输入:电脑台数,比如:10台。输出:电脑信息如下name = Thinkpad-000, price = 1000name = Thi...

2021-11-10 15:38:59 1201

原创 用函数来实现两个数最大值最小值的比较

#include <iostream>using namespace std;int &max(int &num1,int &num2);int &min(int &num1,int &num2);int main(){ int num1,num2; cout<<"输出第一个数"<<endl; cin>>num1; cout<<"输出第二个数"<&l.

2021-10-10 16:26:43 836

原创 99乘法表

#include <iostream>using namespace std;int main(){ int i,j; int n; cin>>n; for(i=1;i<n;i++) { for(j=1;j<=i;j++) { cout<<j<<"*"<<i<<"="<<j*i; i.

2021-10-05 13:39:05 103

原创 水仙花数

#include <stdio.h>#include <stdlib.h>int main(){ int n; scanf("%d",&n); int first=1; int i; for(i=1;i<n;i++) { first*=10; } for(i=first;i<first*10;i++) { int su.

2021-10-04 22:59:32 108

原创 百钱问题

#include <stdio.h>#include <stdlib.h>int main(){ int x; int one,two,five; int cun=0; scanf("%d",&x); for(one=1;one<x*10;one++){ for(two=1;two<x*10/2;two++){ for(five=1;five<x*10/5;five+.

2021-10-04 16:12:53 145

原创 求 平均数

#include <stdio.h>#include <stdlib.h>int main(){ int number; int sum=0; int count=0; scanf("%d",&number); while(number!=-1) { sum+=number; count++; scanf("%d",&number); } pr.

2021-10-04 15:19:22 95

原创 2021-10-04猜一个随机数

#include <stdio.h>#include <stdlib.h>#include<time.h>int main(){ srand(time(0)); int number=rand()%100+1 ; int count=0; int a=0; printf("请输入一个1到100的数:"); do{ scanf("%d",&a); count++.

2021-10-04 15:03:14 75

原创 求平均数....

-1代表结束

2021-10-01 10:10:35 66

原创 给出年份和月份(一般情况,不占空间)

#include <iostream>using namespace std;int main(){ int year; int month; int day; cin>>year; cin>>month; if(month==1||month==3||month==5||month==7||month==8||month==10||month==12) { day=31; .

2021-09-20 11:02:47 78

原创 给出年月,求天数(数组)

#include <iostream>using namespace std;int main(){ int month; int year; cin>>year; cin>>month; int day[]={0,31,28,31,30,31,30,31,31,30,31,30,31};//数组下标从0开始,所以day【2】是指第三个数 if(year%400==0||year%100!=0&am.

2021-09-20 10:45:42 562

原创 返转一个三位数

#include <iostream>using namespace std;int main(){ int number; cin>>number; int a,b,c; a=number/100; b=(number/10)%10; c=number%10; cout<<"原数是:"<<number ; int q; q=c*100+b*10+a; cout<<"转换后的数.

2021-09-16 22:34:33 78

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除