c++实验3作业

项目二

#include
using namespace std;
int main()
{
    int year,month,day;
    cout<<"输入年份和月份:";
    cin>>year>>month;
    if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
        day=31;
    if(month==4||month==6||month==9||month==11)
        day=30;
    if(month==2)
    {
        if(year%4==0&&year%100!=0||year%400==0)
            day=29;
        else
            day=28;
    }
    cout<<"本月有"<

项目三

#include
using namespace std;
int main()
{
        int x;
        double deposit,y1,y2,y3,y4,y5,y6;
		cout<<"欢迎使用利息计算器!"<>deposit;
		cout<<"         存款期限          "<>x;
		y1=deposit*0.031*0.25;
		y2=deposit*0.033*0.5;
		y3=deposit*0.035*1;
		y4=deposit*0.044*2;
		y5=deposit*0.050*3;
		y6=deposit*0.055*5;
        switch(x)
		{
		case 1:cout<<"到期利息为:"<

项目四

#include 
#include 
using namespace std;
int main( )
{
    double x,y;
    cout<<"输入x:";
    cin>>x;
    if(x>=10)
        y=1/x+1;
    else if(x>=6) y=sqrt(x+1);
    else if(x>=2) y=x*x+1;
    else y=x;
    cout<<"y="<


你可能感兴趣的:(c++实验3作业)