Lab Objectives This lab was designed to reinforce programming concepts from Chapter 4 & 5 of C++ Programming: Program Design Including Data Structures, 8th Edition. In this lab you will practice: Problem Description Based on the provided code, create a C++ program as required to display the information for multiple circles. You may name it as Program6_ControlStructures_YourName.cpp. Programming Steps Develop your program with control structures following these steps. Step 1: 1. Create a program as in the following picture 2. Add one more statement after line 12 to print out the area of this circle Input request & validation • Nested for loops • Using counter-controlled repetition Now this program is to display circumference & area of 10 circles with the counter of each iteration as the radius 1 #include 2 using namespace std; 3 4 6 7 8 int main() { cout << "Your Name will create a program with control structures.\n\n"; const double PI = 3.1415; int ct = 10; 9 10 11 12 13 14 15 16 17 18) for (int i=0; i

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

Good morning, can I get help with this c++ homework? Thank you (:

2. Add the while loop in the following picture into your program before the for loop
Let user to decide for how many circles to display information
while(ct<=0) {
cout << "Please enter an integer: ";
cin >> ct;
}
cout << "ct is << ct << endl << endl;
Step 3:
1. Add the following selective structure into your program so
• in your for loop, two cout statements are enclosed within the curly braces in
this selective structure
So, the program is to display the information for circles only when the counter is
even number
if (!(i%2)) {
}
Sample Output
The following is a sample output for the program you are supposed to have finally. You may
enter different number when you run your program.
YourName will create a program with control structres.
Please enter an integer: -9
Please enter an integer: -100
Please enter an integer: 0
Please enter an integer: 5
ct is 5
The circumference of a circle with radius 0 is 0
The area of a circle with radius 0 is 0
The circumference of a circle with radius 2 is 12.566
The area of a circle with radius 2 is 12.566
The circumference of a circle with radius 4 is 25.132
The area of a circle with radius 4 is 50.264
I (Yourname) finally have all done!
...Program finished with exit code 0
Press ENTER to exit console.
Transcribed Image Text:2. Add the while loop in the following picture into your program before the for loop Let user to decide for how many circles to display information while(ct<=0) { cout << "Please enter an integer: "; cin >> ct; } cout << "ct is << ct << endl << endl; Step 3: 1. Add the following selective structure into your program so • in your for loop, two cout statements are enclosed within the curly braces in this selective structure So, the program is to display the information for circles only when the counter is even number if (!(i%2)) { } Sample Output The following is a sample output for the program you are supposed to have finally. You may enter different number when you run your program. YourName will create a program with control structres. Please enter an integer: -9 Please enter an integer: -100 Please enter an integer: 0 Please enter an integer: 5 ct is 5 The circumference of a circle with radius 0 is 0 The area of a circle with radius 0 is 0 The circumference of a circle with radius 2 is 12.566 The area of a circle with radius 2 is 12.566 The circumference of a circle with radius 4 is 25.132 The area of a circle with radius 4 is 50.264 I (Yourname) finally have all done! ...Program finished with exit code 0 Press ENTER to exit console.
Lab Objectives
This lab was designed to reinforce programming concepts from Chapter 4 & 5 of C++
Programming: Program Design Including Data Structures, 8th Edition. In this lab you will
practice:
Problem Description
Based on the provided code, create a C++ program as required to display the information for
multiple circles. You may name it as Program6_ControlStructures_YourName.cpp.
Program 6: Control Structures
Due on Sunday, 11/13/2022, by 11:59pm
Programming Steps
Develop your program with control structures following these steps.
Step 1:
1. Create a program as in the following picture
2. Add one more statement after line 12 to print out the area of this circle
Now this program is to display circumference & area of 10 circles with the counter of each
iteration as the radius
6
7
8
Input request & validation
Nested for loops
Using counter-controlled repetition
1 #include <iostream>
2 using namespace std;
3
4 int main()
5-{
9
10
11
12
13
14
15
16
17
18 }
cout << "Your Name will create a program with control structures.\n\n";
const double PI = 3.1415;
int ct = 10;
for (int i=0; i<ct; i++) {
cout << "The circumference of a circle with radius " << i << " is " «<< 2*PI³i << endl;
cout << "\n\nI (YourName) finally have all done!";
return 0;
Step 2:
1. In line 9 of your program, change 10 to -1
Transcribed Image Text:Lab Objectives This lab was designed to reinforce programming concepts from Chapter 4 & 5 of C++ Programming: Program Design Including Data Structures, 8th Edition. In this lab you will practice: Problem Description Based on the provided code, create a C++ program as required to display the information for multiple circles. You may name it as Program6_ControlStructures_YourName.cpp. Program 6: Control Structures Due on Sunday, 11/13/2022, by 11:59pm Programming Steps Develop your program with control structures following these steps. Step 1: 1. Create a program as in the following picture 2. Add one more statement after line 12 to print out the area of this circle Now this program is to display circumference & area of 10 circles with the counter of each iteration as the radius 6 7 8 Input request & validation Nested for loops Using counter-controlled repetition 1 #include <iostream> 2 using namespace std; 3 4 int main() 5-{ 9 10 11 12 13 14 15 16 17 18 } cout << "Your Name will create a program with control structures.\n\n"; const double PI = 3.1415; int ct = 10; for (int i=0; i<ct; i++) { cout << "The circumference of a circle with radius " << i << " is " «<< 2*PI³i << endl; cout << "\n\nI (YourName) finally have all done!"; return 0; Step 2: 1. In line 9 of your program, change 10 to -1
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
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
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT