| | |
While loop issue
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Apr 2008
Posts: 185
Reputation:
Solved Threads: 10
Okay, I figured out the larger problem that I've been having with my program, now all I need is it to get out of the loop and finish the program. Well, it won't break out for some reason. Anyone see why?
x and y are incremented in ask() and returned. So I figured if
What am I missing?
C++ Syntax (Toggle Plain Text)
row = col = 4; z = 0; do { array[x][y].replace = '?'; print (array, mark, col, row); ask (a, x, y, z, array, row, col, count); if (x == row-1 && y == col-1) break; } while (z == 0);
x and y are incremented in ask() and returned. So I figured if
x == 3 && y == 3 , it should break from the do while loop and that would be fine. The problem is that when it returns from ask(), hits my if, and then says that the program has stopped working and needs to close. What am I missing?
Last edited by DemonGal711; Nov 3rd, 2008 at 1:10 am.
•
•
•
•
and then says that the program has stopped working and needs to close
Obviously the problem is not in this relatively simple (but questionable - for example, why if-break is not a part of do-while condition?) loop. Do you think that we all know where is your previous posts with your sources?
•
•
Join Date: Apr 2008
Posts: 185
Reputation:
Solved Threads: 10
Well, I had messed with my statement a bunch of times, the original was a while where what I had in the if was stopping it.
The problem was a statement after the while was messing it up, I just forgot I had put it in there (cause all the messing with my code I had hit backspace and latched it to the end of the while end bracket. That's what was causing the error, not my while.
The problem was a statement after the while was messing it up, I just forgot I had put it in there (cause all the messing with my code I had hit backspace and latched it to the end of the while end bracket. That's what was causing the error, not my while.
![]() |
Similar Threads
- Pyramid Issue (Visual Basic 4 / 5 / 6)
- cannot start up XP - stuck in restart loop, keyboard frozen (Windows NT / 2000 / XP)
- infinite loop... (C++)
- cin.get issue (C++)
- how to set up my for loop to print my array in reverse (Java)
- Primary Key Issue (Visual Basic 4 / 5 / 6)
Other Threads in the C++ Forum
- Previous Thread: How to copy a file from within the folder the c++ program was executed from?
- Next Thread: postfix calculator
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count data delete deploy desktop developer directshow dll download dynamic encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node number output parameter pointer problem program programming project proxy python read recursion recursive return string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






