Question

What does the following program print?

I // Exercise 3.12 Solution: ex03_12.cpp // What does this program print? #include <iostream> using namespace std; 3 4 7 int

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Output

1

4

9Date Paga Salution Tn fixst pas 91-140hich dels then to hence 4odeal far Second २- 4 HiMe ohen ne totel Same happens for 10 t

16

25

36

49

64

81

100

Total is385

Add a comment
Know the answer?
Add Answer to:
What does the following program print? I // Exercise 3.12 Solution: ex03_12.cpp // What does this...
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
  • c++ only. Please follow directions. What does the following program print and why? Comment each line...

    c++ only. Please follow directions. What does the following program print and why? Comment each line of code to explain what it is doing.   #include <iostream> using namespace std; int main() { int track[ ] = { 10, 20, 30, 40 }; int * ptr; ptr = track; track[1] += 30; cout << * ptr << " "; *ptr -= 10; ptr++; cout << * ptr << " "; ptr += 2; cout << * ptr << " "; cout...

  • Can someone help me fix this program? //SwatTheBugs22.cpp - displays the following pattern of numbers //2...

    Can someone help me fix this program? //SwatTheBugs22.cpp - displays the following pattern of numbers //2 4 6 //8 10 12 //14 16 18 //20 22 24 //Created/revised by Brandon Tousignant on November 30, 2018 #include <iostream> using namespace std; int main() { int number = 0; for (int outer = 1; outer < 5; outer =+ 1) { for (int inner = 1; inner < 4; inner += 1) number += 2; cout << number << " "; //end...

  • 4. (10 pts) Show the output of the following program: (list the program outputs in the...

    4. (10 pts) Show the output of the following program: (list the program outputs in the order as they would appear on screen) #include <iostream> using namespace std; int Mystery(int); int main() int x=2, y: y=Mystery(x - 1)+1; cout << "x="«x«", y="«y < endl; y=Mystery( 2 *x); cout << "x="«x«", y="«y < endl; return 0; int Mystery (int num) int y=5; // This is a regular local variable, not a static local variable int result; y=y+num; cout << "y=" <y<",...

  • 15.6: Fix the code to print the count from 1 to x (to loop x times)...

    15.6: Fix the code to print the count from 1 to x (to loop x times) #include <iostream> // include the header file using namespace std; void count(int x){    for(int i=1; i<=x; i++){ cout<<x; } } int main(){    int x,i;    cin >> x; count(x);    return 0; } 15.7 Fix the nested for loops to print the count from 1 to x twice, e.g. "12....x12.....x" #include <iostream> // include the header file using namespace std; int main(){...

  • Question 28 What is the output of the following program? Assume code is correct. #include <iostream>...

    Question 28 What is the output of the following program? Assume code is correct. #include <iostream> using namespace std; int main() { int i = 1,j,x = 5, y = 4; while (i <= y) { for (j = 0; j <= y2; j++) cout << 'Z'; cout << endl; i=i+1; } return 0; 3 B IV AA-I E333 X X, B, GT 12pt Paragraph

  • I have to type and explain in class each code in every detail filled with //...

    I have to type and explain in class each code in every detail filled with // commentary. Explains how does work in every codes. 1) What does the below print #include <iostream> using namespace std ; int main() {    int var1 = 20 ;    int var2 = 30 ;    int* ptr1 ;    int* ptr2 ;    int* temp ;    ptr1 = &var1 ;    ptr2 = &var2 ;    cout << *ptr1 << endl ;...

  • One dimensional array What this code print #include <iostream> using namespace std; int main () {...

    One dimensional array What this code print #include <iostream> using namespace std; int main () { const int SIZE = 7; int numbers [SIZE] = {1, 2, 4, 8): // Initialize first 4 elements cout << “Here are the contents of the array:\n"; for (int index = 0; index < SIZE: index++} cout << numbers[index] << “ “; cout << endl; return 0; }

  • Fix the following code to print whether the input is positive or negative #include <iostream> #include...

    Fix the following code to print whether the input is positive or negative #include <iostream> #include <string> using namespace std; void positiveOrNegative(int); // declare function int main(){    int y; int result; cin >> y; result = positiveOrNegative(y);    return 0; } void positiveOrNegative(int x){ if (x>=0) cout << "Positive"; else cout << "Negative"; }

  • Follow the instructions for starting C++ and viewing the Intermediate23.cpp file, which is contained in either...

    Follow the instructions for starting C++ and viewing the Intermediate23.cpp file, which is contained in either the Cpp8IChap11\Intermediate23 Project folder or the Cpp8\Chap11 folder. (Depending on your C++ development tool, you may need to open the project/solution file first.) The program uses an array to store the amount of money a game show contestant won in each of five days. The program should display the total amount won and the average daily amount won. It should also display the day...

  • a) Hand-trace the following program and determine and write down what is the output of the...

    a) Hand-trace the following program and determine and write down what is the output of the code.                b) Run the code and compare the program output to your hand-traced result obtained from part (a). #include <iostream> #include <iomanip> using namespace std; void f(); int x = 5; int main() {         cout << "x = " << x << endl;         int x = 6;         cout << "x = " << x << endl;         {                int...

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
ADVERTISEMENT