It has been a while since the last time I was programmed, and I seem to have forgotten whether it is permissible to use an empty "for" loop to create an infinite loop?
for(;;)
I am currently using this method in a program so that it repeatedly asks the user to enter two numeric values, one for each double variable in the program. Then the programs call the function and calculate the sum of these two pairs of numbers.
To complete the program, I have "if" statements that check if the user input value is zero. If the value is zero, the program terminates using "Return 0;" argument.
The program checks each input value of the user if it is equal to zero after the value has been assigned to the variable.
So, to the real question: Is this the right way to get my program to do what I described? Or is there a more / better / acceptable way to program this?
And secondly, is there something wrong with the "Return 0" argument, as I did in this program?
If you think itβs hard to understand what I wrote or had in mind, answer and I will take more time to write everything.
Anonymous
source share