c++

我会发着呆 发表于 1年前 · 关联问题 The missing integer

include

using namespace std; int main() {

int a = 0; int arr[] = { 1,2,3,4,5,6,7,8,9,10 }; int brr[9]; for (int i = 0; i < 9; i++) { cin >> a; brr[i] = a; } for (int j = 0; j < 10; j++) { for (int k = 0; k < 9; k++) { if (arr[j] == brr[k]) { break; } else if (k == 8 && arr[j] != brr[k]) { cout << "The missing integer is:" << arr[j]; break; } } } return 0;

}