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.
1
vote
3answers
33 views
C# - Only read first char with Whileloop
I have been searching for about an hour and simply can't find any solutions to this. I want each row from my .txt-file to be added to my list as long as it starts with the same number. The problem ...
0
votes
0answers
59 views
Calculate database results using while loop [closed]
* Here is my code**
<?php
if (isset($_GET['fname'])){
$emp1 = $_GET['fname'];
$count = $obj->getD();
$as = $count + 7;
if (date('N') == $count) {
...
0
votes
1answer
41 views
Javascript While Loop Returning Strange Results
I apologize in advance if there are several things wrong with my code; I'm still very new to this.
I made a simple little RNG betting game, which follows:
var funds = 100;
var betting = true;
...
0
votes
4answers
82 views
While inside for loop produces infinite loop? [closed]
I apologize for being a newbie, but why does this loop run forever?
for i in range (1,3):
while i < 5:
print ('ha')
-5
votes
0answers
31 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
63 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
41 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
72 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
30 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 ...