minesweeper conflict
Dec 14, 2010 at 4:28am UTC
Hello i am making a minesweeper program that reads the map from a text file. However i cannot get the constructor working properly. Can anyone help me with the constructor?
map.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#include <vector>
#include <fstream>
#include <iostream>
#ifndef _MAP_H_
#define _MAP_H_
class Map
{
public :
Map();
Map(string filename);
void processSquares();
void print();
//return true if there's mine, flase otherwise
bool uncoverLocation(int x, int y);
private :
// 'cheat-sheet' variables
int width, height;
// indicate whether the map has been solved
bool isComplete;
// alternatively you could use arrays...
vector<vector<int > > numSquares;
//original map characters
vector<vector<char > > charSquares;
// 2-d vector of visited squares (for printing)
vector<vector<bool > > visited;
};
#include "map.cpp"
#endif
map.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#include<iostream>
#include <string>
#include<fstream>
#include "map.h"
using namespace std;
Map::Map()
{
ifstream infile;
infile.open ("map.txt" );
while (!infile.eof)
{
getline(infile, vector<vector<char > >);
fin >> vector<vector<char > >;
}
infile.close();
system ("pause" );
}
Map::Map(string filename)
{
}
void Map::processSquares()
{
}
void Map::print()
{
}
bool Map::uncoverLocation(int x, int y)
{
return 0;
}
main.cpp
1 2 3 4 5 6 7 8 9 10 11 12
#include<iostream>
#include<string>
using namespace std;
#include "map.h"
int main(int argc,char ** argv)
{
return 0;
}
map.txt
1 2 3 4 5 6
110022
332143
332132
343221
121100
011100
Dec 14, 2010 at 5:38am UTC
Can someone help me with this....
Topic archived. No new replies allowed.