首页 > 其他分享 >4.19

4.19

时间:2023-04-19 21:56:22浏览次数:30  
标签:4.19 double void int date include id

1 #include<iostream>
2 using namespace std;
3 int main()
4 {
5     int x;
6     cin>>x;
7     cout<<"gong xi ni kao le 90 fen!";
8     return 0;
9 }

 

 1 #include<iostream>
 2 using namespace std;
 3 int main()
 4 {
 5     int a,b,c,d;
 6     cin>>a;
 7     b=a/15;
 8     c=a/20;
 9     d=a*90;
10     cout<<b<<" "<<c<<" "<<d;
11     
12 }
13 #include<iostream>
14 using namespace std;
15 int main()
16 {
17     int N,M,S,X;
18     cin>>N>>M>>S;
19     X=N-M*S;
20     cout<<"hai sheng"<<" "<<X<<" "<<"mi! jia you ya!";
21     return 0;

 

  1 #include<iostream>
  2 #include<string>
  3 using namespace std;
  4 class People
  5 {
  6 private:
  7     int age;
  8     string name;
  9 public:
 10     People(){};
 11     People(int a,string b)
 12     {
 13         age=a;
 14         name=b;
 15     }
 16     ~People(){};
 17     void setValue(int m,string str)
 18     {
 19         age=m;
 20         name=str;
 21     }
 22     void display()
 23     {
 24         cout<<"age:"<<age<<endl<<"name:"<<name<<endl;
 25     }
 26 };
 27 class Student:public People
 28 {
 29 private:
 30     int ID;
 31 public:
 32     Student(){};
 33     Student(int a,string b,int c):People(a,b),ID(c){}
 34     ~Student(){}
 35     void setID(int m)
 36     {
 37         ID=m;
 38     }
 39     void displayID()
 40     {
 41         cout<<"ID:"<<ID<<endl;
 42     }
 43 };
 44 int main()
 45 {
 46     Student s(18,"jia",1111);
 47     s.display();
 48     s.displayID();
 49     int a,c;
 50     string b;
 51     cout<<"请依次输入 年龄 姓名 学号:";
 52     cin>>a>>b>>c;
 53     s.setValue(a,b);
 54     s.setID(c);
 55     s.display();
 56     s.displayID();
 57 }
 58 
 59 
 60 
 61 #include<iostream>
 62 #include<cmath>
 63 using namespace std;
 64 class SavingAccount
 65 {
 66 private:
 67     int id;
 68     double balance;
 69     double rate;
 70     int LastDate;
 71     double accumulation;
 72     void record(int date,double account);
 73     double accumulate(int date) const{
 74         return accumulation+balance*(date-LastDate);}
 75 public:
 76     SavingAccount(int date,int id,double rate);
 77     int Getid(){return id;}
 78     double getbalance(){return balance;}
 79     double Rate(){return rate;}
 80     void deposit(int date,double amount);
 81     void withdaw(int date,double amount);
 82     void settle(int date);
 83     void show();
 84 };
 85 SavingAccount::SavingAccount(int date,int id,double rate):id(id),balance(0),rate(0),LastDate(date),accumulation(0){
 86     cout<<date<<"\t#"<<id<<"is created"<<endl;
 87 }
 88 void SavingAccount::record(int date,double amount){
 89     accumulation=accumulate(date);
 90     amount=floor(amount*100+0.5)/100;
 91     balance+=amount;
 92     cout<<date<<"\t#"<<id<<"\t"<<amount<<"\t"<<balance<<endl;
 93 
 94 }
 95 void SavingAccount::deposit(int date,double amount){
 96     record(date,amount);
 97 }
 98 void SavingAccount::withdaw(int date,double amount){
 99     if(amount>getbalance())
100         cout<<"Error:not enough money"<<endl;
101     else
102         record(date,-amount);
103 }
104 void SavingAccount::settle(int date){
105     double interest=accumulate(date)*rate/365;
106     if(interest!=0)
107     record(date,interest);
108     accumulation=0;
109 }
110 void SavingAccount::show(){
111     cout<<"#"<<id<<"\tBalance:"<<balance;
112 }
113 int main()
114 {
115     SavingAccount sa0(1,21325302,0.015);
116     SavingAccount sa1(1,58320212,0.015);
117     sa0.deposit(5,5000);
118     sa1.deposit(25,10000);
119     sa0.deposit(45,5500);
120     sa1.deposit(60,4000);
121     sa0.settle(90);
122     sa1.settle(90);
123     sa0.show();cout<<endl;
124     sa1.show();cout<<endl;
125     return 0;
126 }

 

标签:4.19,double,void,int,date,include,id
From: https://www.cnblogs.com/lijianlongCode13/p/17334763.html

相关文章

  • 4.19每日总结
    今天完善了科技政策系统<%@pagelanguage="java"contentType="text/html;charset=UTF-8"%><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">......
  • 2023.4.19 那片段 像对未来留言
    加训大数据结构。「LG8528」[Ynoi2003]铃原露露lxl怎么一题多投,很坏啊!考虑哪些\((a_x,a_y)\)有约束力,一是\(a_z>a_x\)且\(a_z>a_y\),或者\(a_z<a_x\)且\(a_z<a_y\)。这也就相当于将\(l\in[L_l,R_l],r\in[L_r,R_r]\)的二元组\((l,r)\)均设为非法。对于一次询问,我......
  • 4.19团队
     调用百度智能识别的接口,制作了安卓使用界面,实现了图片的导入和活体识别,但尚且无法完成准确快速的人脸识别。......
  • 2022.4.19编程一小时打卡
    一、问题描述:设计一个类people,有保护数据成员:age(年龄,整型),name(姓名,string),行为成员:两个构造函数(一个默认,另一个有参数);默认析构函数;voidsetValue(intm,stringstr)给age和name赋值;有一个void类型的纯虚函数display()。设计一个学生类student,公有继承类people,有私有成员......
  • 4.19
    #include<iostream>usingnamespacestd;classPoint{public: voidsetX(intX){ x=X; } intgetX(){ returnx; } voidsetY(intY){ y=Y; } intgetY(){ returny; }private: intx;inty;};classcircle{public: voidsetR(intR){ r=R; } intg......
  • 4.19 1.3
    一、问题描述从1990年1月1日开始三天打鱼两天晒网,以后的某一天是打鱼还是晒网?二、分析1、计算1.1到指定天数有几天2、周期为5天,用天数除以53、用余数判断是打鱼还是晒网123都为打鱼,40为晒网先利用循环求出1.1到指定天数有几天,还要考虑闰年情况(闰年二月29天,平年二月28天......
  • 4.19总结
    SQL学习一、1.注释:单行--或者#注释内容(Mysql特有)--注意空格多行注释/*注释*/showdatabases;--查询当前Mysql下有多少个数据库的名称。Mysql数据库的SQL语句不区分大小写,关键字建议使用大写。二、数据库的创建createdatabasesdb1;--创建dropdatabasesdb1......
  • 4.19打卡
    一、问题描述:对N个整数(数据由键盘输入)进行升序排列。二、设计思路:对于N个数因其类型相同,我们可利用数组进行存储。冒泡排序是在两个相邻元素之间进行比较交换的过程将一个无序表变成有序表。冒泡排序的思想:首先,从表头开始往后扫描数组,在扫描过程中逐对比较相邻两个元素的大小。......
  • 每日总结-23.4.19
    /*noticeview*更新消息是否查看过的状态为“已查看”*输入参数为:id(String)即消息id*返回类型为boolean,true为修改成功,false为未有记录或修改失败**/publicbooleanview(Stringid)throwsException{Pd_noticepd=quer......
  • 4.19打卡
    问题描述:给定一个长度为n的数组,找出其中的最大元素和最小元素的差值。假设数组中的元素范围为[-10000,10000]。设计思路:1.直接排序,取出最大值和最小值,计算其差值;2.遍历数组,同时维护最大值和最小值,最后计算其差值。 程序流程图:1.直接排序,取出最大值和最小值,计算其差值2.......