A while loop is a control structure used in many languages to loop over a set of instructions as long as a particular condition is met.
-5
votes
0answers
30 views
While loops trouble for a hangman game [duplicate]
I am trying to make a hangman game, and I think I am doing the while loop incorrectly.
while (countwrong!=6 || gameword[n] != temp[n] || guesses!=26){
When the guesses goes to 26 or the countwrong ...
-2
votes
3answers
61 views
how to use while loop when no way out of it?
Want to have just one return in this question. Tried to type while but there's no way out of it.
The program counts how many Substrings came in a String.
Any idea?
public class find {
public ...
0
votes
3answers
27 views
Cin input being skipped in do/while loop
cin >> subchoice;
switch(subchoice)
{
case 1:
gold = gold - 5;
cout << "Now you only have " << gold << " gold.\n";
...
-5
votes
1answer
39 views
Hi, I would appreciate some help on a do/while loop. I'm designing a PCD hole calculator which will give a varying amount of answers [closed]
Trying to design a hole pcd calculator, with inputs for pcd and number of holes and outputs giving x and y co-ordinates, the number of which will vary with the number of holes in the pcd.
The code ...
0
votes
1answer
24 views
visual basic do while input
I have to make a "Do - while" input from a TextBox in Visual Basic. I mean I get some value for the amount of the numbers the user should type, and then I have to get this quantity of numbers from a ...
4
votes
2answers
68 views
How does this while loop know when to fail?
I was reading about how to program network sockets and ran across this piece of code:
try {
while (true) { // This is the line in question
int i = in.read( );
if (i == -1) break;
...
1
vote
2answers
58 views
while loop won't break,should break when the counter is no longer less than the length of the array
trying to compare items in a and b and return greatest number at each index in list big - result should be [9,14,9,14,15,18,15].doing this for a class, must use while loop and counter
a = ...
1
vote
1answer
14 views
How do I display something only if there are results in the array from a query?
How would I rewrite this code to only display the <h3> tag only if there are results returned from the query?
I am very new to PHP, I know this can be done, I'm just not sure of the best ...
0
votes
7answers
70 views
Return True if alphanumeric (No methods or import allowed)
What would be a good way to make a function return True if, and only if, what is inputted is alphanumeric (contains only letters or numbers), without using methods or import?
So far in class, we only ...
0
votes
1answer
29 views
jquery toggle one div in php while loop
I have this While loop in my php code where I echo rows inside one div that acts like a button and when I press that "button" I want to hide/show the connected div with the jQuery function "toggle". I ...
0
votes
3answers
35 views
php while loop wont compare variables
I am trying to make a dynamic division that changes its id with a variables. In addition to this, the dvision is a popup. The division has to be unique, since I am pulling info from a database. What I ...
0
votes
1answer
121 views
Visual C# very poor performance in while loop
I am having some trouble with while loops in C#. This happens let's say once per week.
I am looping through a SQL Server data reader and I read simple strings, doubles etc ... I don't understand why ...
0
votes
1answer
23 views
issue with requirejs being called in switch satement
I am having an issue where I am reading a json object to build out a form. As I read the form field types I go through a switch statement on how to build the field with bootstraps. In some cases I ...
1
vote
2answers
28 views
Making a simple adventure game. Want to use a While loop to keep the input prompt rolling after each action
I did this in a previous adventure using this code:
def lobby():
invalid_check == True
while invalid_check == True: #This "while" loops exists solely to loop the command sequence should the user ...
0
votes
1answer
9 views
Java: change variable from outside while looping through a while queque
I am a Java Beginner and have a little question.
I have got 2 Classes:
the first one is a java formular, the important code is:
@Override
public void keyPressed(KeyEvent event) {
int key = ...