In main.cpp line 90 where you insert:
while ( Status == Eecc ecc)
if you use
while (true), the return dont stop the script?
In main.cpp line 90 where you insert:
while ( Status == Eecc ecc)
if you use
while (true), the return dont stop the script?
If the code looks like this:
while (true) { return; }
…then it will absolutely only run once. Maybe I don’t understand the question?
If you use this script :
#include
#includestd::string StopWhile ( std::string Guess );
int main()
{std::string InputGuess = "World"; std::cout << StopWhile( InputGuess ); return 0;
}
std::string StopWhile ( std::string Guess ){
do{if( Guess.size() == 5) { return "stop do/while"; } }while(true);
};
the do/while stops.
In the lessons from 44 to 46, line 89/90 main.cpp, why use while(…) ecc ecc ecc.
with true you use less code
Usually you have a conditional statement in the parenthesis to tell the while
when to stop looping. while(true)
will loop forever if there is no exit condition like return
or break
called in the loop body.
Due to inactivity this topic will close in 7 days.
Please either contact a moderator for this to be unlocked or start a new thread.
Thank-you
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.