1
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class TaroGrid{
public:
int getNumber(vector<string> grid)
{
int n = grid.size(), max = 0, count = 1;
for (int j = 0; j < n; j++)
{
for (int i = 1; i < n; i++)
{
if (grid[i][j] == grid[i - 1][j]) count++;
else count = 1;
if (count > max) max = count;
}
}
return max;
};
};
int main()
{
TaroGrid test;
vector<string> cool;
int t = test.getNumber(cool);
cout << "The largest number of cells Taro can choose is: " << t <<endl;
return 0;
}
你的代碼沒有編譯:這個錯誤是什麼?
錯誤鏈接:
TaroGrid-stub.o:In function `main':
TaroGrid-stub.cc:(.text.startup+0x0): multiple definition of `main'
TaroGrid.o:
TaroGrid-stub.cc:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status
你在鏈接什麼? – OMGtechy 2014-08-31 22:48:00
告訴我們你是如何建造的。 – 0x499602D2 2014-08-31 22:51:43