63.取一个整数a从右端开始的4~7位。

//输入一个数据后用“/”和“%”分离

#include<iostream>
using namespace std;

int main()
{
    int temp1,temp2;
    double n;

    begin:
    cout<<"please input an number:"<<endl;
    cin>>n;

    if(n<1000000)
    {
        cout<<"wrong input, please try again!"<<endl;
        goto begin;
    }else
    {
        temp1=n/1000;
        for(int i=4;i<=7;i++)
        {
            temp2=temp1%10;
            cout<<""<<i<<"位是:"<<temp2<<endl;
            temp1=temp1/10;
        }
    }

    return 0;
}
原文地址:https://www.cnblogs.com/jixiaowu/p/3907200.html