Most voted "do-while" questions
29 questions
Sort by count of
-
21
votes3
answers1786
viewsWhat is the usefulness and importance of "do... while"?
The command while is a repeat structure with a condition at the beginning of the declaration. Example: while (condição) { sentenças a executar } Already do...while has verification at the end, ie…
algorithm loop characteristic-language while do-whileasked 9 years, 4 months ago Denis Caixeta 3,427 -
7
votes3
answers1492
viewsWhile repeating structure to recalculate in C
I solved this exercise below and thought about putting a structure while repeat, for the person to calculate again. But when I put’s' to return and calculate again, the exercise sums up the values…
-
6
votes2
answers354
viewsFinding roots of a function in Fortran
I created a code that uses 3 methods to determine the roots of a function, the direct method of kicking x, Newton-Raphson and secant values. In the direct method, I set x values close to the roots,…
-
4
votes3
answers441
viewsWhy is it not very common to use do/while?
I don’t know if this occurs only in PHP, but I realize that it is not very common the use of do/while in the codes written on it. Example: while (ob_get_level() > 0) { ob_end_clean(); } That (I…
-
3
votes1
answer69
viewsComparison of index (get) in Array List not working properly
I’ve been trying to compare a string (right answer) for an alternative question as an example in a project I’m developing, but I can’t succeed in all the different ways I try. The goal is that every…
-
3
votes2
answers295
viewsProper use of while to validate data entry
I’m trying to apply a repetition using the while also using the IF condition, which returns a message to the user if they enter an invalid value. Note that I write nothing inside the while, but the…
-
2
votes3
answers1286
viewswhile for number other than 0 in C
I need the program to stop when the consumer number is 0. So I put one of the while saying that as long as the consumer number is different from 0 he continues the program and when the consumer…
-
2
votes1
answer4995
views -
2
votes1
answer1282
viewsLoops based on a flowchart
How do I write the code for a loop based on this flowchart? It has a do...while. Peeciso of a simple and direct response with nested loops.…
-
2
votes1
answer54
viewsOutput condition on do-while in code C
I need the user to enter the numbers 1, 2 or 3 to choose the locations, and if not select one, ask again. But when entering the number 0 or 4, for example, it returns to the start screen (that would…
-
1
votes1
answer69
viewsBlock Prints
The programme should: receive a 4 digit number, sort and keep, sort downward and save. Subtract increasing to decreasing and save so that the process starts again until subtraction equals 6174. I…
-
1
votes2
answers2428
viewsHow to use getche() with do-while in C?
I have the following variable : #include <stdio.h> #include <stdlib.h> #include <conio.h> char op; And I’m asking the user to enter a character : printf("\nDeseja realizar novo…
-
1
votes2
answers9649
viewsAutomatically fill cells in excel using VBA
Good afternoon community, I am trying to work with VBA in Excel in order to try to apply this knowledge in my master’s thesis, but I have some doubts. I am trying to create a VBA function that fills…
-
1
votes1
answer65
views -
1
votes2
answers98
viewsContinue "do while" from last point
There is a registration program that I must perform, I put the registration options and etc. All the code is saved in the vectors and are as expected, but when I return to main(), it goes back to…
-
1
votes2
answers1272
viewsStore all records of a table in a variable (PHP)
I need to make a query in my Mysql database and store all rows that are returned within the variable $dadosBrutos. The intention is that each line be separated by the character "§", for example:…
-
1
votes2
answers2198
viewsProgram Ignoring the Scanf
I need to create an algorithm as requested below, but every time I run the program it "skips" steps. For example: I want you to stay like this Product: "Potato" Sector: "Food" Quantity: "15" Price:…
-
1
votes2
answers105
viewsMy while has no end
I am making a calculator. The program performs operations depending on the number the user chooses. The problem is that when you type 5 it is to end the loop and this is not happening. int…
-
0
votes3
answers454
viewsLoop of repetition in C
Hello, I’m a beginner in programming and I have a question: I’m making a program that has a menu and a registration to be performed by the user. I would like to know how to make the menu of the…
-
0
votes1
answer279
viewsWhile C++ does not enter the loop using string getline
Good afternoon guys, I’m having a problem with my code. When I ask if the user wants to repeat the program, it just doesn’t loop. I’ve tried using the user as numerical information and it worked,…
-
0
votes1
answer97
views -
0
votes1
answer184
viewsHow to get the program out of the loop
In the exercise I am doing, it is asked that when the number of repetitions is 0, finish the execution, but when I type 0 it does nothing and continues to read numbers. It reads a number K of…
-
0
votes1
answer43
viewsDoubt about while loop on C?
I need to know why 0 has to be typed twice in order for the program to stop traversing the loop. And the same thing happens when I use the do-while. #include <stdio.h> #include…
-
-1
votes1
answer580
viewsWhat would be the equivalent of while in python?
What would be python’s "do while"? Grateful!
-
-1
votes1
answer89
viewsDo While is not working properly
Do while is not working in the code. At first the test that I am doing now is only the first of the menu (register the user) and then should go back to the menu until S is typed. (It is running only…
-
-1
votes1
answer22
viewsCompare 4 Variables and execute unique code for each result
Hello, I’m trying to create a comparison where the next action will be different for each variable value someone can help me. The intention is if the value is true, executes one function if it is…
-
-1
votes1
answer43
viewsJavascript: Is there a way to do a do-while test the condition before the end of the loop?
Context: I’m developing a text-based RPG and at the time of doing the battle mechanics I’m having this 'problem'. Ex: function verificarEstado(pessoa){ if (pessoa.estado != 'normal') { /* aqui terá…
-
-3
votes1
answer43
viewsProblem with do while
public static void main(String[] args) { Scanner sc = new Scanner(System.in); BancoConta p1 = new BancoConta(); p1.inicio(); } public void inicio() { do { System.out.println("Para criar conta…
-
-5
votes2
answers72
viewsWhy does "0" not appear? Once the logic of "do while" is: do yourself then check
If you literally analyze the loop do while, makes perfect sense since something is done while this is true, but pragmatically has no logic. For example, in the code below, when we arrive at the…