码迷,mamicode.com
首页 > 其他好文 > 详细

错题1

时间:2019-01-15 23:33:47      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:ret   char   turn   int   std   span   ring   space   nbsp   

1

#include<string>
using namespace std;

int sev(int a)
{
    int t=0;
    while(a>0)
    {
        t=a%10+t*10;
        a=a/10;
    }
    return t;
}

int main()
{
    int n;
    while(cin>>n)
    {
        if(n==0) break;
        int a[5];
        int b=sev(n);
        for(int i=0;i<5;i++)
        {
            a[i]=b%10;
            b=b/10;
        }    
        string s;
        char s1[5];
        cin>>s;
        
        for(int i=0;i<5;i++)
        {
            s1[i]=s[i]+a[i];
        }
        
        cout<<s1<<endl;
    }
}

 

错题1

标签:ret   char   turn   int   std   span   ring   space   nbsp   

原文地址:https://www.cnblogs.com/ilovetheworld/p/10274785.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!