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
votes
5answers
55 views
looping to print out - java
I am trying to print out all the elements in the linked list. however, i am unable to print out the complete list of item.
public void display()
{
int count =0;
if (head ...
5
votes
5answers
100 views
while loop in C# with multiple conditions
This is my code:
while( Func(x) != ERR_D)
{
if(result == ERR_A)
throw...;
if(result == ERR_B)
throw...;
mydata.x = x;
}
The problem is that I want to use result = ...
0
votes
3answers
68 views
PHP - Order in a while loop
<div class="row">
<?php
$r=mysql_query("SELECT * FROM advertisements WHERE $filter exposure!='0' AND `status`='2' AND (clicks_left_micro>0 OR clicks_left_mini>0 OR ...
2
votes
5answers
71 views
How to end a while Loop via user input
package cst150zzhw4_worst;
import java.util.Scanner;
public class CST150zzHW4_worst {
public static void main(String[] args) {
//Initialize Variables
double length; // length of room
...
0
votes
2answers
25 views
Loop in which Scanner does not fetch input
Im having a problem creating an error message in my distance to origin calculator program.
double x; // x coordinate
double y; // y ...
-1
votes
1answer
40 views
Use while loops to read file
I'm working on a project for school and I'm having some trouble here. I am to go through a file for a trivia game. The format of the file is as follows: The first line of the file will be the category ...
2
votes
2answers
37 views
using(s) inside a loop with a continue
Given the following sample code:
var count = 0;
while (count < 5)
{
using (var request = new HttpRequestMessage(HttpMethod.Get, requestUri))
using (var response = await ...
1
vote
1answer
13 views
file system creation script on AIX using while loop
#!/bin/sh
echo "VG: "
read VG
echo "LP: "
read LP
echo "SAP: "
read SAP
echo "NUM: "
read NUM
echo "SID: "
read SID
while [[ $NUM -lt 2 ]]; read VG LP SAP NUM SID ; do
mklv -y $SAP$NUM -t ...
3
votes
1answer
26 views
How to Write an Asynchronous While Loop in Node.JS
I am writing a node.js app for to help automate some of my home brewery. One of the modules I am using is a PID algorithm to control outputs so that they maintain certain setpoints. I am currently ...
0
votes
2answers
57 views
java while loop not breaking out
So I am writing a program where somebody draws cards from a deck. So I wrote a while loop that loops through and checks to see if there are over 4 of the randomly created card drawn, and if there is, ...
-4
votes
1answer
50 views
Can I sum up all variable from each previous loop in do-while loop? [on hold]
Is it possible to sum up all the variables in each previous loop until it stops in a do-while loop? I'm just using a simple & basic coding in C++. It looks like this:
do
{
cout << "Please ...
0
votes
6answers
64 views
While loop output
The program will generate the correct output for the first number guess but after the user inputs the second guess, there is no output at all. Please help! THANKS
final int number = ...
1
vote
1answer
27 views
Bash append to variable using while read syntax
I have file which looks like following:
/usr/local/bin
/bin
/usr/bin
/usr/local/sbin
/usr/sbin
/sbin
/home/user/.local/bin
/home/user/bin
/home/user/perl5/bin
now I want to concatenate the lines by ...
1
vote
4answers
93 views
Java - while loop not working as expected
I am working with a fairly basic programming task in Java. We are asked to create a chat-robot, where the robot is to answer randomly from a set of given strings until the user writes "Bye!", where ...
0
votes
3answers
32 views
strpos result 0 stops while loop
i need to find the all positions of a particular character in a string. I am using the following code
$pos = 0;
$positions = array();
while( $pos = strpos($haystack,$needle,$pos){
...