| | |
1 does not equal 5, but my code thinks so...
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Aug 2007
Posts: 4
Reputation:
Solved Threads: 0
Hi, I am having a strange problem with a simple process. Heres the code.
This code is part of a larger algorithm but I just cut out the part of focus. Say the while loop has been entered and increm gets incremented from 0 to 1. Say tgPlacers.size() is 5.
Now in the if statement when it says if(inCrem == tgPlacers.size()); (for example, if 1 == 5), it goes through to declaring Anything = false, ect. 1 does not equal 5 and it should not be entering the if.
Anyone know why this could be happening? Let me know if you need more info.
Thanks
C++ Syntax (Toggle Plain Text)
bool areNumbers = true; bool Anything = true; int numBytes = 1; long inCrem = 0; while(gPlacerID != tgPlacers[inCrem]->GetPlacerTypeID()) { inCrem++; if(inCrem == tgPlacers.size()); { Anything = false; break; } }
Now in the if statement when it says if(inCrem == tgPlacers.size()); (for example, if 1 == 5), it goes through to declaring Anything = false, ect. 1 does not equal 5 and it should not be entering the if.
Anyone know why this could be happening? Let me know if you need more info.
Thanks
Last edited by seanw; Aug 5th, 2007 at 4:51 pm.
What you really have is this
if(inCrem == tgPlacers.size())
{
/* The ; at the end of your if is a NO-OP */
}
{
Anything = false;
break;
}![]() |
Similar Threads
- no error message but showing project not compiled (C++)
- truth table to boolean algebraic equation (Java)
- Unsorted List ADT Client Code Help (C++)
- Programming -- a group effort (IT Professionals' Lounge)
- Quick Question (C++)
- Source Code that don't work? (Java)
- Array cell contains the memory address of the next cell ???? (C)
- Comparing arrays (C++)
- simple program tokenizer problem (Java)
Other Threads in the C++ Forum
- Previous Thread: Help with C++
- Next Thread: need compiler translation!
Views: 1975 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






