Question

C++ Visual Studio 1. How many iterations are in the following "while" loop? int i =...

C++ Visual Studio

1. How many iterations are in the following "while" loop?

int i = 0;
while(i < 20) 
{

    ++i;
}

2. How many iterations are in the following "for" loop?

for(int i = 5; i < 17; i = i + 2)
{
    // Work
}

How many times will '+' be printed?

int i = 0;
while(true)
{
     if(i == 5)
     {
          break;
     }

     cout << "+";
     ++i;
}

3. How many times will '+' be printed?

int i = 0;
while(true)
{
     if(i == 5)
     {
          break;
     }

     cout << "+";
     ++i;
}

4. How many '?' will be printed?

for(int i = 0; i < 10; ++i)
{
    for(int j = 0; j < 5; ++j)
    {
        cout << "?";
    }
}
0 0
Add a comment Improve this question Transcribed image text
Answer #1
1.
20 iterations

2.
6 iterations

3.
5 times

4.
5 times

5.
50 times

Add a comment
Know the answer?
Add Answer to:
C++ Visual Studio 1. How many iterations are in the following "while" loop? int i =...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • How many Iterations will this while loop perform? int ico), j(10); cout << "i = "...

    How many Iterations will this while loop perform? int ico), j(10); cout << "i = " << i << endl; cout << "j = " << j << endl; while (i > j) { cout << "j-" « j << endl; j += 2; cout << "i = " << i << endl; } cout << "i = << i << endl; cout << "j = " << j << endl; 5 6 C 8 10 Infinite times Does the...

  • C++ 5.How many times will the following loop run? int i=5; while (i19) 6 . What...

    C++ 5.How many times will the following loop run? int i=5; while (i19) 6 . What is the output of the following code snippet? int time 1; int year2 int rate = 1; int principal = 5; int interest-0 cout <<i < endl while (year< 5) interest (principal * time rate) /1 ; cout << interest << endl; year++

  • Language is C++ Complete the following Review Questions: 1. This is a control structure that repeats...

    Language is C++ Complete the following Review Questions: 1. This is a control structure that repeats a group of statements in a program? a. loop b. switch c. main() function d. compiler 2. In the expression number++,the ++operator is in what mode? a. Prefix b. Pretest c. Postfix d. Posttest 3.This is a variable that controls the number of iterations performed by a loop. a. Loop control variable b. Accumulator c. Iteration register variable d. Repetition meter 4. The do-whileloop...

  • MICROSOFT VISUAL STUDIO C++: 13. What will be printed when the following statements are executed? int...

    MICROSOFT VISUAL STUDIO C++: 13. What will be printed when the following statements are executed? int x = 0, y = 0; do { if(x == y) x= x + 1; else y=y — 1; } while (x<y + 4); cout << “y=“ <<y <<“ X=" << x << endl;

  • in c++ language 1.Re-write the following for loop statement by using a while loop statement: int...

    in c++ language 1.Re-write the following for loop statement by using a while loop statement: int sum = 0; for(int i=0;i<=1000;i++){                 sum+=i; } 1 (b). Following is the main () function of a program. The program asks a user to enter 150 integers and print the largest integer user entered. int main() {    int score, highest;             //missing portion of the program             return 0;    } 1(c). Find the missing portion of the following code, so the...

  • What kind of Loop Structure is this? iterations evals Notes 16a-int (inputO) 17 b a Step Statemen...

    please fill the tables We were unable to transcribe this imageWhat kind of Loop Structure is this? iterations evals Notes 16a-int (inputO) 17 b a Step Statement 18 for x in range(a 3, a5, 2): 2 20 21 else: 23 24 print(b) 4 5 6 8 9 10 12 13 What kind of Loop Structure is this? Step Statement Notes iterations evals 18 19 20 21 iteration-0 evals-0 print("Boolean evaluation #:", evals) prin "Iteration #:", iteration! 23 evals1 24 while...

  • Problem with C++ program. Visual Studio say when I try to debug "Run-Time Check Failure #2...

    Problem with C++ program. Visual Studio say when I try to debug "Run-Time Check Failure #2 - Stack around the variable 'string4b' was corrupted. I need some help because if the arrays for string4a and string4b have different sizes. Also if I put different sizes in string3a and string4b it will say that those arrays for 3a and 3b are corrupted. But for the assigment I need to put arrays of different sizes so that they can do their work...

  • 11) 16 pts. Convert the following for loop to a while loop. (You may want to...

    11) 16 pts. Convert the following for loop to a while loop. (You may want to do the following question first.) int mine [5] = {10, 11, 12); for (int j=1; j < 5; j++) cout <<j<< "" << mine[jl <<" " << end1; 12) 6 pts. What is the output of the previous question? 13) 4 pts. Circle the variables that would NOT cause syntax errors 2-smaTT , entry# break -my-int

  • THIS IS FOR C++ PROGRAMMING USING VISUAL STUDIO THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING #inclu...

    THIS IS FOR C++ PROGRAMMING USING VISUAL STUDIO THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING #include "pch.h" #include #include using namespace std; // Function prototype void displayMessage(void); void totalFees(void); double calculateFees(int); double calculateFees(int bags) {    return bags * 30.0; } void displayMessage(void) {    cout << "This program calculates the total amount of checked bag fees." << endl; } void totalFees() {    double bags = 0;    cout << "Enter the amount of checked bags you have." << endl;    cout <<...

  • I am trying to run this program in Visual Studio 2017. I keep getting this build...

    I am trying to run this program in Visual Studio 2017. I keep getting this build error: error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". 1>Done building project "ConsoleApplication2.vcxproj" -- FAILED. #include <iostream> #include<cstdlib> #include<fstream> #include<string> using namespace std; void showChoices() { cout << "\nMAIN MENU" << endl; cout << "1: Addition...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT