#include
#include
#include
#include "grid.h"
using namespace std;
int main (int argc, char *argv[]) {
if (argc != 4)
{
cerr << "Usage: " << argv[0] << " grid_file col_no row_no" << endl << endl;
return EXIT_FAILURE;
}
grid *g;
g = new grid (argv[1]);
int row = atoi (argv[2]);
int col = atoi (argv[3]);
cout << "The colony including the cell at "
<< "(" << row << "," << col << ")"
<< " has an area of " << g->count (row,col) << " units." << endl;
cout << *g << endl;
delete g;
return EXIT_SUCCESS;
}
这是题目给的main函数,给了grid.h和grid.cpp,还有一个数据文件是sample.grid,我把这个文件放在源文件目录下了,可是看不懂main函数怎么读取这个文件的,而且运行的结果总是在if (argc != 4)就跳出了,输出的是 usage: G:\文档\Visual Studio 2005\Projects\Assessing Infection\debug\assessing infection.exe grid_file col_no row_no
这个问题困扰很久了,希望高手能赐教,感激不尽~~
--------------------next---------------------
阅读(1185) | 评论(0) | 转发(0) |