P
Pascal Steiss
Hi All
I don't understand the error that g++ tells me:
---
percul3.cpp: In function `void OutputLattice(std::stack<latticeSite,
std::deque<latticeSite, std::allocator<latticeSite> > >)':
percul3.cpp:49: `iterator' is not a member of type
`std::stack<latticeSite, std::deque<latticeSite,
std::allocator<latticeSite> > >'
percul3.cpp:49: parse error before `;' token
percul3.cpp:51: `it' undeclared (first use this function)
percul3.cpp:51: (Each undeclared identifier is reported only once for
each function it appears in.)
---
It's about the code (look for the stars):
#include <sys/types.h>
#include <unistd.h>
#include <iostream>
#include <stack>
#include <iterator>
#include "time.h"
#include "stdio.h"
using namespace std;
const int sMax = 5;
const int nnn = 4;
long g[sMax+1][nnn * sMax +1];
struct latticeSite {
int x,y;
};
typedef stack<latticeSite> myStackType;
enum latticeState { _blocked, _free, _reachable };
const int latticeSize = 100;
latticeState lattice[latticeSize][latticeSize];
int originX = latticeSize / 2;
int originY = 1;
myStackType tempUntriedSites;
long loopCount = 0;
void OutputLattice(myStackType currentUntriedSites) {
cout << endl << endl << endl;
for (int y = originY+sMax; y >= 0; y--) {
cout << "|";
for (int x=originX-sMax; x<=originX + sMax; x++) {
switch(lattice[x][y]) {
case _free: cout << " "; break;
case _reachable: {
//doesn't work too...
//myStackType::iterator it_;
** stack<latticeSite>::iterator it;
** latticeSite tempSite; tempSite.x = x; tempSite.y = y;
it = find(currentUntrietSites.begin(),
currentUntriedSites.end(), tempSite);
if (it != currentUntriedSites.end()) {
cout << "X"; break;
}
}
case _blocked: cout << "B"; break;
}
cout << "|";
}
cout << endl;
}
}
Thank you
Pascal
I don't understand the error that g++ tells me:
---
percul3.cpp: In function `void OutputLattice(std::stack<latticeSite,
std::deque<latticeSite, std::allocator<latticeSite> > >)':
percul3.cpp:49: `iterator' is not a member of type
`std::stack<latticeSite, std::deque<latticeSite,
std::allocator<latticeSite> > >'
percul3.cpp:49: parse error before `;' token
percul3.cpp:51: `it' undeclared (first use this function)
percul3.cpp:51: (Each undeclared identifier is reported only once for
each function it appears in.)
---
It's about the code (look for the stars):
#include <sys/types.h>
#include <unistd.h>
#include <iostream>
#include <stack>
#include <iterator>
#include "time.h"
#include "stdio.h"
using namespace std;
const int sMax = 5;
const int nnn = 4;
long g[sMax+1][nnn * sMax +1];
struct latticeSite {
int x,y;
};
typedef stack<latticeSite> myStackType;
enum latticeState { _blocked, _free, _reachable };
const int latticeSize = 100;
latticeState lattice[latticeSize][latticeSize];
int originX = latticeSize / 2;
int originY = 1;
myStackType tempUntriedSites;
long loopCount = 0;
void OutputLattice(myStackType currentUntriedSites) {
cout << endl << endl << endl;
for (int y = originY+sMax; y >= 0; y--) {
cout << "|";
for (int x=originX-sMax; x<=originX + sMax; x++) {
switch(lattice[x][y]) {
case _free: cout << " "; break;
case _reachable: {
//doesn't work too...
//myStackType::iterator it_;
** stack<latticeSite>::iterator it;
** latticeSite tempSite; tempSite.x = x; tempSite.y = y;
it = find(currentUntrietSites.begin(),
currentUntriedSites.end(), tempSite);
if (it != currentUntriedSites.end()) {
cout << "X"; break;
}
}
case _blocked: cout << "B"; break;
}
cout << "|";
}
cout << endl;
}
}
Thank you
Pascal