手记

c plus plus作业二题2

include "stdafx.h"
include<iostream>

using namespace std;

int main()
{
int x,a,b,c,d;
cout << "Please enter a four-digit integer:\n";
cin >> x;
a = x / 1000;
b = x % 1000 / 100;
c = x % 1000 % 100 / 10;
d = x % 1000 % 100 % 10;
a = (a + 7) % 10;
b = (b + 7) % 10;
c = (c + 7) % 10;
d = (d + 7) % 10;
a = a + c;
c = a - c;
a = a - c;
b = b + d;
d = b - d;
b = b - d;
cout << a << b << c << d;
return 0;
}

0人推荐
随时随地看视频
慕课网APP