Most voted "while" questions
Use this tag when the question primarily involves logic and/or command structure. Effectively, while is a repeat loop used to iterate matrices, vectors, or to another end that basically has a single component, the stop condition.
Learn more…332 questions
Sort by count of
-
0
votes1
answer66
viewsHow do I use a "or" no while in C
I’m trying to make a naval battle application with the while stop with 2 conditions, which are the player’s mistakes or hits, where he can miss 5 times and have to hit all points, which in this case…
-
0
votes1
answer121
viewsUse php to set column width depending on while result
I have the following code $result_categorias = "SELECT * FROM categorias ORDER BY ordem ASC"; $resultado_categorias = mysqli_query($conn, $result_categorias); $total_categorias =…
-
0
votes1
answer583
viewsC++ While iterator skipping Cin.getline reading
I am starting in C++, during some tests I noticed that after the second iteration of while the Cin.getline command was not read displaying the line after it. I don’t understand what happens. Follow…
-
0
votes1
answer34
viewsRepeat number at each count
How do I do this in php, please help me: ( Every three times ) 0 = 0 1 = 0 2 = 0 3 = 1 4 = 1 5 = 1 6 = 2 7 = 2 8 = 2 So on and so forth. This is a simple example of what I would like to do, because…
-
0
votes2
answers124
viewsWhat’s wrong with this loop?
I am wanting to download a.exe file from my FTP server, but there is a part of the code that is giving me trouble. Error: Invalid expression term while (CS1525) someone can tell me what’s wrong?…
-
0
votes3
answers1665
viewsmultiples of 2 and 3 in python
I’m making a code to compute the first(s) n(s) multiples of two values, and put it in a list. until ai perfect but in the list occurs multiple equal numbers, as could take the equal number from the…
-
0
votes0
answers450
viewsLoop Sending Emails with PHP
Guys this is my first post and I would love your help: I have a query in a database that sends automatic email through PHP Mailer if the activity is delayed, so far so good, the problem is in…
-
0
votes0
answers467
viewsHow do I add 2 (binary)? Python
I want to add 2 to a binary number that the user enters and then add 2 binary values. EX: 111001 - 110001, I make the complement of 2 in the second number and then I make the sum of these values, I…
-
0
votes1
answer52
viewsUpdate variable in IF
Good morning, I am unable to update a variable within the IF structure and use it later in my code. Follows excerpt from my code: while ($dado_participante = mysqli_fetch_array($qry2)) { //REGISTRO…
-
0
votes2
answers120
viewsCreate a variable inside an xpath
I’m trying to create an automation in python - (web scraping) that has a loop in which xpath changes every time you click on the desired location, so I realized that xpath only changes one digit:…
-
0
votes1
answer44
viewsPrevent repetition of an element in a part of the code
I have the following exercise that asks me to define an interval and sum all the even values of that interval showing which numbers are summed between them, like: Min=10 Max=15 10+12+14=36. However.…
-
0
votes1
answer543
viewsFPDF with Mysql and PHP - Bringing Repeated Data
I’m trying to set up a generator system Vouchers/Tickets I have a table in SQL with the name Vouchers with multiple users and their respective passwords. I call in each Cell the variable…
-
0
votes3
answers104
viewsHow do I make Python not turn to the upper or lower case letters of the code?
Code: while(1): x= str (input ('Meu avô tinha dois cachorros, um se chamava Pet e o outro se chamava Repete, o Pet morreu, quem é que ficou?')) if x != 'Repete': print("Errado!") break The idea of…
-
0
votes1
answer65
viewsQuestions about storing values in a variable
I’m having trouble understanding this particular while loop: #include <stdio.h> main() { int c; c = getchar(); while (c != EOF) { putchar(c); c = getchar(); } } The result of an execution is…
-
0
votes3
answers1636
viewsStart numeric variable with null value in Python
Browsing the Python Brasil site, I decided to do exercise 1 of the Repetition Structure list: "Make a program that asks for a note, between zero and ten. Display a message if the value is invalid…
-
0
votes0
answers9
viewsdifficulty in using while
I started language in C but am having difficulty in while for a program where I need to enter 3 options to be typed and when one of them is out (negative) for the program
-
0
votes1
answer162
viewsMysql lost connection in While PHP
I make a consultation via ajax, but, your return is being: mysqli_query(): MySQL server has gone away in mysqli_query(): Error reading result set's header in mysqli_fetch_array() expects parameter 1…
-
0
votes1
answer120
viewsWhile error in joption pane: loop
I’m having a serious problem with while in the following algorithm: You have a data set containing the height and gender (male, female) of 50 people. Make an algorithm that calculates and writes: 1…
-
0
votes2
answers144
viewsinsert a cursor inside of a while on android
on android i have a cursor where it searches the data in the database and returns the data perfectly but.. as I insert a second cursor inside the first? to pull data from a second table my code try…
-
0
votes2
answers137
viewsProblem sending input value (which is updated in a While) to another page via POST
I have a looping loop while which creates fields according to the number of customer municipalities. I need to pass the variable codmunicipio via method POST to be inserted into the database on…
-
0
votes1
answer89
views -
0
votes1
answer74
viewsAdding value in the picturebox
I wonder if there’s any way to make it work here int chck = 0; int fid = 0; while (chck < 150) { try { sqlcon.Open(); string sql2 = "SELECT img FROM clienteimg WHERE ((clienteid = '" + cid + "')…
-
0
votes1
answer294
viewsInfinit Scroll - does not bring all BD data
I am trying to implement an Infinit scroll in my project, but I am having difficulty solving this problem the connection is perfect and I’m receiving the information from BD, but the code only shows…
-
0
votes1
answer86
viewswhile read does not work in Unix shell script
I’m writing a script and using while read twice he makes the 1 only once: un=$(echo $LOGNAME | tr '[A-Z]' '[a-z]') grep -v '^#' nodeteste.txt > auxiliar.txt while read line do ssh "$un@$line"…
-
0
votes1
answer327
viewsphp, bring multiple rows from one linked table to another single id table
I’m having a hard time retrieving information. In the data for printing, I need to show in the variable $comp when she belongs to the same id_cadastro that I am consulting, so far everything well,…
-
0
votes2
answers402
viewsPHP - array shuffle
I’m programming a page of feed on news in PHP. I ask for your help to help me shuffle the array $tagsArray for posts not always stay in the same order. Thank you in advance! Code: <?php $conexao…
-
0
votes4
answers11856
viewsHigher and lower value problem with while. (No list!)
Write a program that reads an integer N and then read N real numbers, separating the smallest and largest, presenting them on the screen. N = int(input("Digite N: ")) i = 0 ma = 'maior' me = 'menor'…
-
0
votes1
answer113
viewsSelect from all users with only one result from each user
Hey, good night, man. I think the title is a little fuzzy, I’ll try to explain better. I’m making a chat system and I want to list all user conversations, but only one message from each user.…
-
0
votes1
answer45
viewsCycle for only runs once inside a while and should always be run
listaA = new ArrayList <>(); boolean n = true; while (listaA.size() < listab.size()) { Log.i( "while ordena" , String.valueOf( listaA.size() )); valorAl = nRandom.nextInt( listab.size() );…
-
0
votes2
answers31
viewsAdd value in name
I have a while, and wanted each loop to be added a different value in name, two select fields. Ex: First loop first field comes: weekday1 First loop first field comes: weekday2 Does anyone have any…
-
0
votes3
answers3591
viewsHow to use "while not in" in Python?
I tried to loop with while to check if a condition was met. If the user enters 0, 1 or 2 the program should stop asking the user which number he will choose. If the user chooses a number other than…
-
0
votes0
answers122
views"SIGSEGV ON THREAD", can someone help me to solve, and also, if possible, to complete the program?
Here’s the thing, I do an info tech, and I’ve been learning C for just two months, and I don’t know much yet. Recently my teacher asked me to make a program in which user entered with two numbers…
-
0
votes1
answer35
viewsshow the value of the child inputs of Divs js
I need the for/while to show on the screen the string placed in the input of the first div the first time the loop is executed and the second time to show on the screen the string placed in the…
-
0
votes0
answers40
viewsRestart the while loop method
I have a script to generate a certain amount of random Cpfs in a text file. When executing the method that generates the random CPF within the while, the method is executed only once and always…
-
0
votes1
answer633
viewsParse txt file and return to another file - Python
Good night! There is a file with numbers, save in txt format, each number separated by space, with a list with about 50 values in each line of the txt file (and more than 10,000 lines in the file):…
-
0
votes1
answer48
viewsHow to put a layout for the search results of an input search that is inside echo?
I need to put a layout in the search results of input search, I have a page that uses the layout of bootstrap 4 Cards, and I wanted the search results to be the same. This is the script I use in my…
-
0
votes1
answer133
viewsHow to declare null values in C
My problem is the next one I’m creating loop while which cannot receive values less than or equal to zero, and would also declare that it cannot receive empty values for the program force the user…
-
0
votes2
answers64
viewsWhy doesn’t the loop print up to the last value that was entered as the limit?
I made a code that prints a sequence of numbers, from the number typed to the end, but when printing it the last number is not appearing. Example: first number typed is 3 and the second is 7. The…
-
0
votes3
answers1537
viewsCalculate the age group of 10 people within a repeat loop?
Below is the code I am using, this presenting the following error: SyntaxError: invalid syntax maycon@maycon-H14SU08:~/Documentos/Algoritimos$ python3 prova_lista.py File "prova_lista.py", line 23…
-
0
votes1
answer37
viewsMy script looking for a string in another string is taking too long
My script loads the command1(file1) and saves the first column of all rows in an array, later it will search for each substring of that array in a 2(from command2) file. The problem is that file 1…
-
0
votes1
answer108
viewsWhile and Rand() loop voting system
I’m making a website with a voting system, but the images change places with the function Rand(). So far so good, but when it comes to voting, when I click on a button, the only one that works is…
-
0
votes1
answer44
viewsWhat’s wrong with the code? He was supposed to check while, but when I type continue or cancel he keeps repeating!
System.out.println("Qual produto você deseja verificar a disponibilidade? "); System.out.println("Digite: Prato, Copo, Talheres, ou Cancelar para sair! Ou continuar " + "para dar seguimento a…
-
0
votes2
answers444
viewswhile true x loop
Developing some scripts in Ruby I come across the following situation: There are indeed several Repetition Structures, but 2 in particular caught my attention. while true and loop do. Both generate…
-
0
votes3
answers2698
viewsSeparate even and odd numbers with two vectors in C
I have the following problem: I need to read several numbers until the number typed is 0 or one of the vectors is fully filled, in case the vector must have a maximum of 10 indexes, and for each…
-
0
votes2
answers78
views -
0
votes1
answer80
viewsPopulate vector and check if current position value is equal to previous
btnInnerText(btns[0],sorteio()); var bool = true; for(var i=1;i<btns.length;i++){ do{ btnInnerText(btns[i],sorteio()); for(var j=0;j<btns.length;j++){ if(getValorBTN(i)==getValorBTN(j))…
-
0
votes1
answer401
views -
0
votes1
answer89
viewsHow to loop with invalid object message?
I am only doing this program to train, and I want to print a message saying "invalid object" if what I type is different from the solids that will be declared in the variables, but with a loop while…
-
0
votes1
answer42
viewsVariable sum does not take the value within the loop!
print ("Produto Numero 1") ValorDaMercadoria = float(input("Qual o valor da mercadoria? ")) print("Produto 1",":",ValorDaMercadoria) NumeroDoProduto = 2 ValorDaMercadoriaLaco = 1 while…
-
0
votes1
answer74
viewsDuplicate Data Loop Query Nodejs
I’m having a problem with a loop loop on node js, this is the query exports.getValueMsg = function() { return new Promise((resolve, reject) => { pconn .pool .query("SELECT b.numero_serie,…