C++ How to Program (10th Edition)
C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 4, Problem 4.12E

(What Does this Program Do?) What does the following program print?
1. // Exercises 4.12: Mystery.cpp
2. #include <iostream>
3. using namespace std;
4.
5. int main () {
6. unsigned int x {1};
7. unsigned int total {0};
8.
9. while (x <= 10) {
10. int y = x * x;
11. cout << y<< end1;
12. total += y;
13. ++x;
14. }
15.
16. cout << “Total is ”<< total << end1;
17. }

Blurred answer
Students have asked these similar questions
Q3: (Tax Calculator) Develop a Java program that determines the total tax for each of four citizens. The tax rate is 10% for earnings up to 50,000 RM earned by each citizen and 15% for all earnings in excess of that ceiling. You are given a list with the citizens’ names and their earnings in a given year. Your program should input this information for each citizen, then determine and display the citizen’s total tax. Use class Scanner to input the data.
1) #include #include int power(int, int); int main(void) { int x, n; printf("Enter a number and powerto raise it to: "); scanf_s("%d %d", &x, &n); printf("Result: %d\n", power(n, x)); return 0; } int power(int x, int n) { int m; if (n == 0) return 1; if (n % 2 == 0) { m = power(x, n / 2); return m * m; } else return x * power(x, n - 1); } 2) #include int hcf(int n1, int n2); int main() { int n1, n2; printf("Enter any two positive integers: "); scanf("%d %d", &n1, &n2); printf("Greatest Common Divisor of %d and %d is %d.", n1, n2, hcf(n1,n2)); return 0; } int hcf(int n1, int n2) { if (n2 != 0) return hcf(n2, n1%n2); else return n1; } 3) #include int main() { int array[], minimum, size, c, location = 1; printf("Enter the number of elements in array\n"); scanf("%d",&size); printf("Enter %d integers\n", size); for ( c = 0 ; c < size ; c++ ) scanf("%d", &array[c]); minimum = array[0]; for ( c = 1 ; c < size ; c++ ) { if ( array[c] < minimum ) {…
(Python matplotlib or seaborn) CPU Usage We have the hourly average CPU usage for a worker's computer over the course of a week. Each row of data represents a day of the week starting with Monday. Each column of data is an hour in the day starting with 0 being midnight. Create a chart that shows the CPU usage over the week. You should be able to answer the following questions using the chart: When does the worker typically take lunch? Did the worker do work on the weekend? On which weekday did the worker start working on their computer at the latest hour?   cpu_usage = [ [2, 2, 4, 2, 4, 1, 1, 4, 4, 12, 22, 23, 45, 9, 33, 56, 23, 40, 21, 6, 6, 2, 2, 3], # Monday [1, 2, 3, 2, 3, 2, 3, 2, 7, 22, 45, 44, 33, 9, 23, 19, 33, 56, 12, 2, 3, 1, 2, 2], # Tuesday [2, 3, 1, 2, 4, 4, 2, 2, 1, 2, 5, 31, 54, 7, 6, 34, 68, 34, 49, 6, 6, 2, 2, 3], # Wednesday [1, 2, 3, 2, 4, 1, 2, 4, 1, 17, 24, 18, 41, 3, 44, 42, 12, 36, 41, 2, 2, 4, 2, 4], # Thursday [4, 1, 2, 2, 3, 2, 5, 1, 2, 12, 33, 27, 43, 8,…

Chapter 4 Solutions

C++ How to Program (10th Edition)

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Algebraic Expressions – Algebra Basics; Author: TabletClass Math;https://www.youtube.com/watch?v=U-7nq7OG18s;License: Standard YouTube License, CC-BY
Python Tutorial for Beginners 3 - Basic Math, Mathematical Operators and Python Expressions; Author: ProgrammingKnowledge;https://www.youtube.com/watch?v=Os4gZUI1ZlM;License: Standard Youtube License