Re: I need more eyes on this one.
From: Pedro Graca (hexkid_at_hotpop.com)
Date: 07/04/04
- Next message: Francis Glassborow: "Re: I need more eyes on this one."
- Previous message: Francis Glassborow: "Re: a question about private access"
- In reply to: KPR: "I need more eyes on this one."
- Next in thread: Francis Glassborow: "Re: I need more eyes on this one."
- Reply: Francis Glassborow: "Re: I need more eyes on this one."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 4 Jul 2004 13:19:46 GMT
KPR wrote:
> I'm getting a "parse error before 'else'" at the line indicated by the
> arrow. Can anybody see what the heck is wrong?
> -----------------------------------------------------------------------------------------------------------------------
> void IS_IT_A_DDR(string& mtgrec,string& temprec,int& ddrrc) {
> string Day2="SunMonTueWedThuFriSat";
> string Daytoken="0123456";
> int badday=0;
> if (mtgrec.size() < 8) {
> ddrrc=0;
> return;
> }
> for (int i=0; i <= 6; i++) {
> if (mtgrec.substr(0,3) == Day2.substr((i+1)*3-3,3)) {
> if ((mtgrec.substr(3,1) == "0") || (mtgrec.substr(3,1) ==
> "1")) {
> if ((mtgrec.substr(7,1)).find_first_of("BCLMOPSTW*") !=
> -1) {
> temprec=Daytoken.substr(i,1) + mtgrec.substr(1);
> ddrrc=1;
> return;
> }
> else {
> ddrrc=2;
> return;
> }
> else {
><<<<<=====================================
> ddrrc=3;
> return;
> }
> }
> }
> else badday++;
> }
> if (badday == 7) {
> ddrrc=4;
> return;
> }
> else ddrrc=5;
> return;
> }
> --------------------------------------------------------------------------------------------------------------------------------
Remove everything execpt the for() loop
------------
for (int i=0; i <= 6; i++) {
if (mtgrec.substr(0,3) == Day2.substr((i+1)*3-3,3)) {
if ((mtgrec.substr(3,1) == "0") || (mtgrec.substr(3,1) == "1")) {
if ((mtgrec.substr(7,1)).find_first_of("BCLMOPSTW*") != -1) {
temprec=Daytoken.substr(i,1) + mtgrec.substr(1);
ddrrc=1;
return;
}
else {
ddrrc=2;
return;
}
else { <<<<<=====================================
ddrrc=3;
return;
}
}
}
else badday++;
}
------------
Now remove all code, keeping just the structure
--------
for () {
if () {
if () {
if () {
}
else {
}
else { <<<<<=====================================
}
}
}
else badday++;
}
--------
Now remove the innermost if() else
--------
for () {
if () {
if () {
else { <<<<<=====================================
}
}
}
else badday++;
}
--------
Do you see the parse error now? :)
-- USENET would be a better place if everybody read: | to email me: use | http://www.catb.org/~esr/faqs/smart-questions.html | my name in "To:" | http://www.netmeister.org/news/learn2quote2.html | header, textonly | http://www.expita.com/nomime.html | no attachments. |
- Next message: Francis Glassborow: "Re: I need more eyes on this one."
- Previous message: Francis Glassborow: "Re: a question about private access"
- In reply to: KPR: "I need more eyes on this one."
- Next in thread: Francis Glassborow: "Re: I need more eyes on this one."
- Reply: Francis Glassborow: "Re: I need more eyes on this one."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|