Questions tagged as 'while'

1
answer

Problem with condition in While in C ++

Hello, I'm studying from Bjarne's "PROGRAMMING Principles and Pratice Using C ++" book. I'm trying to make Drill number 1 from chapter four. The exercise says to do a program that consists of a while-loop that reads and prints two integers and s...
asked by 01.02.2016 / 19:21
1
answer

Subcategory listing according to selected category

I have the following code snippet: <?php foreach($categorias as $cat){ $id_cat = $cat['id']; $subcategorias = array(); $sqlsub = Comando::Executar("SELECT * FROM subcategoria WHERE cat_pai = '$id_cat' ");...
asked by 02.02.2015 / 22:26
1
answer

Store variable within a While

I have a simple question but it's breaking my head: I have a form where there are several checkboxes, the value of the checkbox is an id number, I would like to create something that when the user selects a certain number of checks the system m...
asked by 13.01.2015 / 21:41
1
answer

Save single row in DB, the result of the PHP variable (WHILE / LOOP) of a MYSQL Query

I have the following problem: When performing a query, the result of the while is composed of more than one value, for example: $query_sku = mysqli_query($connect, "SELECT t.column_name FROM skus AS s INNER JOIN table...
asked by 04.01.2019 / 15:12
0
answers

make a while loop or restart the program in tkinter with a new question

I would like to know how to do when I click the answer button, restart the program with a new account and optimize the code? from tkinter import* from random import randrange janela=Tk() janela.geometry('100x80') janela.resizable(0,0) a=(ran...
asked by 09.06.2018 / 00:25
0
answers

Why does an error occur at the end of a file that ends with whitespace in a while loop, using the read operator?

I want to execute a read function from a "material" vector (I created this type with "struct"). The reading will be executed from a file. std::vector<material> material_read(std::string s) { std::ifstream data(s); dados.exception...
asked by 15.05.2018 / 16:31
1
answer

Specifying height and sex of students with a "while"

The exercise asks me to read 20 students and their respective heights and sex, and then show the average height and how many men and women we have. What I did was the following: int main() { float altura, media; char gen, mediam, me...
asked by 09.04.2018 / 15:15
1
answer

Print the previous 30 issues

I have to print the 30 numbers before the number chosen by the user. while(valor > (30 - valor)){ System.out.println(valor); --valor; } I did so, but it does not print the previous 30, sometimes yes, sometimes not, where can I be...
asked by 04.06.2017 / 18:21
0
answers

Is it a good programming practice to write a while with a true argument so that it runs infinitely?

In a hypothetical situation: Is it a good programming practice, writing a while this way? So that it continues to run endlessly? while(true){ System.out.println("Por favor, Escolha: "); System.out.println("1: Adicionar Cliente");...
asked by 10.05.2016 / 19:49
3
answers

How to make the first two numbers of a Math.random sequence are not EQUAL

I made a lottery system in order to learn, I will not post the whole code here just the part that I am packed. It is as follows: The draw of the PC is a sequence of 6 numbers that I present in the DOM (it does not matter), so I want the first...
asked by 05.10.2014 / 07:02