Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

so with variable k state above this statement as an unsigned integer of 10. I am getting an infinite loop with this while loop as

so with variable k state above this statement as an unsigned integer of 10. I am getting an infinite loop with this while loop as pictured no matter the value of 'k" I change to it continues to be infinite. I was asked how I would fix this without changing anything inside the loop and only the line above it. I finally figured out that I must do a "do while" loop after a lot of research. My question is why was it going in an infinite loop before? In the while loop do you have to change both variables inside since they the condition? Please explain to me why this was happening, I'm I thinking about this correct?

image text in transcribed

//Second Loop while (k >= i) unsigned int i{ 10 }; cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions