將int數組轉換爲向量最簡單的方法是什麼?並在if語句中使用它。將數組轉換爲向量
即
int num1[4] = {2, 4, 1, 8};
int num2[4] = {2, 4, 6, 8};
if (testNUM(num1, num2, 4))
cout << "ERROR: num1 and num2 are reported to be the same.\n";
else
cout << "SUCCESS: num1 and num2 are correctly identified "
<< "as different.\n";
testNUM被聲明爲函數原型(BOOL)。
感謝,
請定義'testNUM' –
'num1'和'num2'都是數組,爲什麼你需要將它們轉換爲向量? – azz