I write a code, that finding a difference between two array sequences. There are a lot of versions that I tried and succeeded in.
#include <iostream>
int main() {
const int N = 10;
int inputFirst[N];
int inputSecond[N];
int output[N];
int j = 0;
for (int i = 0; i < N; i++) {
std::cin>>inputFirst[i];
}
for (int i = 0; i < N; i++) {
std::cin>>inputSecond[i];
}
for (int i = 0; i < N; i++) {
if (inputFirst[i] != inputSecond[i]) {
output[j++] = inputFirst[N - I];
}
}
for (int i =0; i <j; i++) {
std::cout<<output[i]<<" ";
}
}
How can I change my code to get the right answer for this input case?
15 -50 68 78 194 66 752 -111 789 -1000
0 -10000 85 -50 456 -111 854 15 -752 78
I need to get this answer:
68 194 66 752 789 -1000