Starting Out With C++: Early Objects (10th Edition)
10th Edition
ISBN: 9780135235003
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 5, Problem 31RQE
Write a nested loop that displays the following output:
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Describe the difference between the while loop and the do-while loop.
For glass-box testing of a for loop, you should test cases where:
For glass box tesitng of a for loop, you should test cases where:
a) the for loop is not entered
b) the body of the for-loop is executed just once
c) the body of the for-loop is executed more than once
d) all of these
Q: Write a program which displays the following pattern as an output.
1
22
333
4444
55555
(Hint: using loop
Chapter 5 Solutions
Starting Out With C++: Early Objects (10th Edition)
Ch. 5.1 - How many lines will each of the following while...Ch. 5.1 - Prob. 5.2CPCh. 5.3 - What will each of the following program segments...Ch. 5.6 - In the following program segment, which variable...Ch. 5.6 - Find four errors in the following code that is...Ch. 5.6 - Write a sentinel-controlled while loop that...Ch. 5.7 - Prob. 5.7CPCh. 5.7 - Write a program segment with a do-while loop that...Ch. 5.7 - Revise your answer to Question 5.8 to use the...Ch. 5.8 - What three expressions appear inside the...
Ch. 5.8 - You want to write a for loop that displays I love...Ch. 5.8 - Prob. 5.12CPCh. 5.8 - Write a for loop that displays your name 10 times.Ch. 5.8 - Write a for loop that displays all of the odd...Ch. 5.8 - Write a for loop that displays every fifth number,...Ch. 5.8 - Write a for loop that sums up the squares of the...Ch. 5.8 - Write a for loop that sums up the squares of the...Ch. 5.8 - Write a for loop that repeats seven times, asking...Ch. 5.8 - Write a for loop that calculates the total of the...Ch. 5.11 - Which loop (while, do-while, or for) is best to...Ch. 5.11 - How many total stars will be displayed by each of...Ch. 5.11 - What will the following program segment display?...Ch. 5.12 - Prob. 5.24CPCh. 5.12 - What header file must be included in a program to...Ch. 5.12 - What five steps must be taken when a file is used...Ch. 5.12 - What is the difference between a text file and a...Ch. 5.12 - Prob. 5.28CPCh. 5.12 - What type of file stream object do you create if...Ch. 5.12 - What type of file stream object do you create if...Ch. 5.12 - If dataFi1e is an of stream object associated with...Ch. 5.12 - If dataFile is an ifstream object associated with...Ch. 5.12 - Assume you have an output file named numbers.txt...Ch. 5 - To _______ a value means to increase it by one.Ch. 5 - To _______ a value means to decrease it by one.Ch. 5 - Prob. 3RQECh. 5 - Prob. 4RQECh. 5 - The statement or block that is repeated is known...Ch. 5 - Each repetition of a loop is known as a(n)...Ch. 5 - A loop that evaluates its test expression before...Ch. 5 - A loop that evaluates its test expression after...Ch. 5 - A loop that does not have a way of stopping is...Ch. 5 - A(n) ______ is a variable that counts the number...Ch. 5 - Prob. 11RQECh. 5 - A(n) ________ is a variable that is initialized to...Ch. 5 - A(n) ______ is a special value that marks the end...Ch. 5 - The ________ loop is ideal for situations that...Ch. 5 - The _____ loop always iterates at least once.Ch. 5 - The _______and ______ loops will not iterate at...Ch. 5 - Inside the for loops parentheses, the first...Ch. 5 - A loop that is inside another is called a(n)...Ch. 5 - The _________ statement causes a loop to terminate...Ch. 5 - The _____ statement causes a loop to skip the...Ch. 5 - What header file do you need to include in a...Ch. 5 - What data type do you use when you want to create...Ch. 5 - What happens if you open an output file and the...Ch. 5 - What data type do you use when you want to create...Ch. 5 - What is a files read position? Where is the read...Ch. 5 - What should a program do when it is finished using...Ch. 5 - Write a do-while loop that asks the user to enter...Ch. 5 - Write a for loop that displays the following set...Ch. 5 - Write a loop that asks the user to enter a number....Ch. 5 - Write a nested loop that displays the following...Ch. 5 - Rewrite the following code, converting the while...Ch. 5 - Rewrite the following code, replacing the do-while...Ch. 5 - Convert the following whi1e loop to a for loop:...Ch. 5 - Convert the following for loop to a while loop:...Ch. 5 - Complete the program segment below to write the...Ch. 5 - Complete the following program segment that reads...Ch. 5 - What will each of the following program segments...Ch. 5 - int x = 1 ; while (x 10) x++; cout x;Ch. 5 - Each of the program segments in this section has...Ch. 5 - A) // This code should use a loop to raise a...Ch. 5 - A) // This code should display the sum of two...Ch. 5 - Prob. 46RQECh. 5 - Characters for the ASCII Codes Write a program...Ch. 5 - Sum of Numbers Write a program that asks the user...Ch. 5 - Distance Traveled The distance a vehicle travels...Ch. 5 - Celsius to Fahrenheit Table In one of the Chapter...Ch. 5 - Speed Conversion Chart Write a program that...Ch. 5 - Ocean Levels Assuming the level of the Earths...Ch. 5 - Circle Areas The formula to compute the area of a...Ch. 5 - Pennies for Pay Write a program that calculates...Ch. 5 - Weight Loss If moderately active persons cut their...Ch. 5 - Calories Burned Running on a particular treadmill,...Ch. 5 - Membership Fees Increase A country club, which...Ch. 5 - Random Number Guessing Game Write a program that...Ch. 5 - Random Number Guessing Game Enhancement Enhance...Ch. 5 - The Greatest and Least of These Write a program...Ch. 5 - Student Line-Up A teacher has asked all her...Ch. 5 - Rate of Inflation The annual rate of inflation is...Ch. 5 - Population Write a program that will predict the...Ch. 5 - Math Tutor Version 3 This program started in...Ch. 5 - Hotel Suites Occupancy Write a program that...Ch. 5 - Rectangle Display Write a program that asks the...Ch. 5 - Diamond Display Write a program that uses nested...Ch. 5 - Triangle Display Write a program that uses nested...Ch. 5 - Arrowhead Display Write a program that uses nested...Ch. 5 - Sales Bar Chart Write a program that asks the user...Ch. 5 - Savings Account Balance Write a program that...Ch. 5 - Using FilesTotal and Average Rainfall Write a...Ch. 5 - Using FilesPopulation Bar Chart Write a program...Ch. 5 - Using FilesStudent Line Up Modify the Student...Ch. 5 - Using FilesSavings Account Balance Modification...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Car Class Write a class named Car that has the following data attributes: _ _year_model (for the car's year mo...
Starting Out with Python (3rd Edition)
T F Class members are private by default.
Starting Out with C++ from Control Structures to Objects (8th Edition)
Who is a programmers customer?
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Function names should be as short as possible.
Starting Out with Python (4th Edition)
For each of the following activities, give a PEAS description of the task environment and characterize it in te...
Artificial Intelligence: A Modern Approach
Open the Chap3\ Error2\ Error2 project from the student sample programs folder. The application has an error. F...
Starting Out With Visual Basic (7th Edition)
Knowledge Booster
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
- 1)Write a loop which asks 5 integers from user (Scanner) and calculates and printstheir average2) Rewrite as a for loop3) Rewrite as a do-while looparrow_forwardQ:01: Differentiate between the following, with help of examples. for loop and nested for loop while and do-while looparrow_forwarda. Block of code that is executed repeatedly as long as a condition is 1) satisfied A loop is: b. Block of code that is executed once as long as a condition is satisfied c. Block of code that is executed when a condition is false d. None of the abovearrow_forward
- in python for glass box testing of a while loop, you should test cases where: a) the while loop is not entered b) the body of the while loop is executed just once c) the body of the while loop is executed more than once e) all of these f) exiting the loop in the middle of the bodyarrow_forwardAll of the following are looping control structures except Select one: while loop do-while loop for loop do loop none; all of these are looping control structuresarrow_forward[Twenty-first question]arrow_forward
- In short please.arrow_forwardThe following program is designed to input two numbers and output their sum. It asks the user if he/she would like to run the program. If the answer is Y or y, it prompts the user to enter two numbers. After adding the numbers and displaying the results, it again asks the user if he/she would like to add more numbers. However, the program fails to do so. Correct the program so that it works properly. #include <iostream>#include <iomanip>using namespace std;int main(){char response;double num1;double num2;cout << "This program adds two numbers." << endl;cout << "Would you like to run the program: (Y/y) ";cin >> response;cout << endl;cout << fixed << showpoint << setprecision(2);while (response == 'Y' && response == 'y'){cout << "Enter two numbers: ";cin >> num1 >> num2;cout << endl;cout << num1 << " + " << num2 << " = " << (num1 - num2)<< endl;cout <<…arrow_forwardThe following program is designed to input two numbers and output their sum. It asks the user if he/she would like to run the program. If the answer is Y or y, it prompts the user to enter two numbers. After adding the numbers and displaying the results, it again asks the user if he/she would like to add more numbers. However, the program fails to do so. Correct the program so that it works properly. #include <iostream> #include <iomanip> using namespace std; int main() { char response; double num1; double num2; cout << "This program adds two numbers." << endl; cout << "Would you like to run the program: (Y/y) "; cin >> response; cout << endl; cout << fixed << showpoint << setprecision(2); while (response == 'Y' && response == 'y') { cout << "Enter two numbers: "; cin >> num1 >> num2; cout << endl; cout << num1…arrow_forward
- Which of the following Statement is NOT True? a)do-while loop will not execute at least once, if condition not true. b)While loop will not execute at least once, if condition not true. c)While and do-while loops used for repetition of statements. d)The do-while or while loop may not stop, if you use floating-point values for equality checking.arrow_forwardProblem Statement Please modify the following code to use only the DO-WHILE loops. The program prompts a user for an integer input. It takes an input as a size of a square. The program will output the square to the screen. #include int main() ( int size 0; Int 10; int 101 //prompt a user for an input printf("Please input a int at a size of a square: "); scanf("%d", &size); //output a square to the screen printf("\n*****Print square****** fort size; I++){ while(5+ size) 1 3.0; printf("\n"); return 0; Edit View Insert Format Tools Table Earrow_forward[Calculate grades’ average for a student] write a program that calculates the student grades’ average for a semester for the number of courses taken in that semester. Your program should do the following: 1.Read from user the number of courses (n) 2. Then, read the courses’ grades for n times (Hint: use a loop) 3.If a grade is grater than 100 or less than 0, ask the user to enter the grade again. 4.Calculate the average of grades using the following formula: average = (sum of grades) / n 5.Print out the average grade on the screen. Note: Always use appropriate data types.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming Tutorial 36 - Intro to Loops; Author: Caleb Curry;https://www.youtube.com/watch?v=M3o7Y0juEP0;License: Standard YouTube License, CC-BY