”Read integers from the keyboard until you enter the same number twice in succession. Read the numbers, to display the form (ABAC) (have four digits and the first and third number are the same) with the property that the sum of two numbers is a number of identical digits.
example, two such numbers are: 1217 (with figures sum 11) and 6861 (the sum of digits 22)”
yes.
mostly line 10 and the use of 's'.
also that you ask for two numbers from user.
basically your code should be this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
int x = 0;
while(true){
int temp;
cin >> temp;
if(temp == x) return 0;
else x = temp;
if(x < 1000 || x >= 10000) continue;//error. are there 4 digits?
//do the splitting. it would be nice to use an array and a for loop here, but do whatever you like.
if(/*first digit*/ != /*third digit*/) continue;//error
s = /*the sum of the digits*/;
if(s%10 != s/10) continue;//error
cout << x;
}