实验1

2-4

#include<iostream>
using namespace std;

int main(){
    int day;

    cin>>day ;
    switch (day) {
        case 1:
            cout<<"workday.Let's work hard."<<endl;
            break;
        case 2:
            cout<<"workday.Let's work hard."<<endl;
            break;
        case 3:
            cout<<"workday.Let's work hard."<<endl;
            break;
        case 4:
            cout<<"workday.Let's work hard."<<endl;
            break;
        case 5:
            cout<<"workday.Let's work hard."<<endl;
            break;
            cout<<"workday.Let's work hard."<<endl;
            break;
        case 6:
            cout<<"weekend.Let's have a rest."<<endl;
            break;
        case 7:
            cout<<"weekend.Let's have a rest."<<endl;
            break;
        default:
            cout<<"error"<<endl;
            break;
    }
     return 0;
}



2-6

#include<iostream>
using namespace std;

int main(){
    int n, right_digit=0, newnum=0;
    cout <<"Enter the number";
    cin>>n;
    
    cout<<"The number in reverse order is";
    do{
        right_digit*=10;
        right_digit+=n%10;
        n/=10;
    }while(n!=0)

    cout<<right_gidit;
    cot<< endl;

return 0;
}

总结

对于一些明知道比较繁杂的部分仍然不能迅速找到便捷高效的方法去实现运行效果,另外,做课程设计能让我从中慢慢了解计算机编程的方法和思路。
posted on 2018-03-18 00:42  breadbaek  阅读(132)  评论(0)    收藏  举报