我有以下問題:相同位置具有相同值的測試陣列
這裏是...輸出摘要如下。
輸出摘要:測試兩個數組以確定它們是否在同一位置包含相同的值。編寫一個測試函數isEqual的主程序。使用原型:BOOL的isEqual(INT A [],INT B [])
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
#define FLUSH cin.clear(); while(cin.get()!='\n');
bool isEqual (int A[], int B[]);
int main()
{
int index;
bool matches[10] = {0, 1, 0, 0, 0, 1, 0, 0, 0, 0};
int A[10] = {2, 3, 4, 5, 8, 11, 15, 7, 3, 1};
int B[10] = {1, 3, 7, 2, 3, 11, 8, 9, 10, 0};
for (index = 0; index <= 9; index++)
{
matches[index] = isEqual (A[index], B[index]);
}
if (matches[index] == 1)
{
cout << 1 << endl;
}
}
bool isEqual (int A[], int B[])
{
return (A == B);
}
我必須使用所示的isEqual()的原型,但不知道怎麼去比賽數組中的正確的價值觀。
你所要做的是根本錯誤的,我建議你修改一下你的教授一直教你的東西。 – 2010-12-07 02:01:40
'isEqual`試圖做什麼?如果你可以評論你的代碼,說明你是如何處理這個問題的,那麼幫助你會更容易。 – Maxpm 2010-12-07 02:15:20