C语言实验1

时间:2022-08-10 05:10:29
#include<iostream>
using namespace std;
int main()
{
    int day;
    cin>>day;
        switch(day)
        {
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:cout<<"workday.Let's work hard"<<endl;break;
        case 6:
        case 7:cout<<"weekend.Let's have a rest"<<endl;break;
        default:cout<<"input error"<<endl;break;
        }
        return 0;  
}
C语言实验1
 
 
#include<iostream> 
using namespace std;
int main()
{
    int x,y=0;
    cout<<"enter the number :";
    cin>>x;
    cout<<"the number in reverse order is:";
    while(x>0)
    {
        y=y*10+x%10;
        x=x/10;
    }
    cout<<y<<endl;
    return 0;
}

  C语言实验1