Three Basic C++ Questions in MS VS. I just need the code! Will Pay

profilebobsmith5690

1.     Write code that will ask the user to input a 4 digit code say “3456” à Drive the user crazy by insisting they entered a wrong code even if they entered the correct code!! After 3 attempts, display a message telling the user you were messing with them! And they are now logged in.Copy & paste the final code in the answersheet, take a snapshot of the final output.

 

2.     Write code that will print the square roots of the first 25 odd positive integers.For each odd number print the following sentence: The square root of __ is __.

 

Copy & paste the final code in the answersheet, take a snapshot of the final output.

 

Try to run the following program at http://cpp.sh/

 

 #include <iostream>

using namespace std;

int main()

{

      int hour;

int min;

 

      for (hour = 1; hour <= 11; hour++)

      {

            for (min = 0; min <= 59; min++)

            {

                  cout << hour << ":" << min << "AM" << endl;

            }

      }

      system("pause");

      return 0;

}

 

1.      What is the bug or logic error in the above program?

2.      Add the lines to fix it.

3.      This is an example of __nested__________ loops.

4.      How many times does the outer loop execute?

5.      How many times does the inner loop execute?

6.      Make the times more accurate by adding lines of code to print seconds.

 

**If you can include some simple notes on how you solved the questions, that would be great!**

    • 9 years ago
    • 10
    Answer(1)

    Purchase the answer to view it

    blurred-text
    NOT RATED
    • attachment
      okalfinal.docx
    Bids(0)