run and modify a program from an existing file a. Download from Avenue | Assessment | Lab report L1 the file P1_1.cpp and copy its content to the clipboard b. start Visual Studio, open a new project, and paste the code from the clipboard in the newly created .cpp file c. compile the code; are the result reasonable? d. rewrite the statement that calculates the interest using a compound assignment operator (see Lecture 1, page 5) and compile the p rogram; did you get the same output? e. substitute all end line strings “\n” with << endl and compile the code; did you get the same output? f. initialize nine float variables with values containing 2 to 6 digits (each one different) and display these values on three rows and three columns using a space between them (hint: use single quotes). How are the columns aligned? g. repeat (copy and paste) the previous display and substitute each space that separates the values printed on the screen with a horizontal tab (hint: use an escape sequence). How are the columns aligned? h. repeat again the previous display and print each of the nine values in a field of 10 characters (hint: use an output formatting manipulator). How are the columns aligned? i. add an “alarm” at the end of the program, just before return 0; compile the code and check if you can hear the beep 4. Write from scratch a program with the following tasks: a. input a negative integer (use cout and cin) b. define a float variable that stores the absolute value of the first integer c. calculate the square and the square root of the new variable and print them in field of eight characters d. input a positive real number e. calculate its square, its square root, its natural logarithm and its base-10 logarithm f. declare a new variable and use it to input an angle (in degrees) g. calculate its sine, cosine and tangent, and display them using a precision of 3 digits h. print the values entered from the keyboard and calculated in the previous steps using complete explanations (ex. “The square of 4 is 16”, or “The tangent of 45 degrees is 1”)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Compile (debug), run and modify a program from an existing file a. Download from Avenue | Assessment | Lab report L1 the file P1_1.cpp and copy its content to the clipboard b. start Visual Studio, open a new project, and paste the code from the clipboard in the newly created .cpp file c. compile the code; are the result reasonable? d. rewrite the statement that calculates the interest using a compound assignment operator (see Lecture 1, page 5) and compile the p rogram; did you get the same output? e. substitute all end line strings “\n” with << endl and compile the code; did you get the same output? f. initialize nine float variables with values containing 2 to 6 digits (each one different) and display these values on three rows and three columns using a space between them (hint: use single quotes). How are the columns aligned? g. repeat (copy and paste) the previous display and substitute each space that separates the values printed on the screen with a horizontal tab (hint: use an escape sequence). How are the columns aligned? h. repeat again the previous display and print each of the nine values in a field of 10 characters (hint: use an output formatting manipulator). How are the columns aligned? i. add an “alarm” at the end of the program, just before return 0; compile the code and check if you can hear the beep 4. Write from scratch a program with the following tasks: a. input a negative integer (use cout and cin) b. define a float variable that stores the absolute value of the first integer c. calculate the square and the square root of the new variable and print them in field of eight characters d. input a positive real number e. calculate its square, its square root, its natural logarithm and its base-10 logarithm f. declare a new variable and use it to input an angle (in degrees) g. calculate its sine, cosine and tangent, and display them using a precision of 3 digits h. print the values entered from the keyboard and calculated in the previous steps using complete explanations (ex. “The square of 4 is 16”, or “The tangent of 45 degrees is 1”)
100 %
Output
1
2
3
4
5
25
26
27
28
6
7
8
9
10
11
20
21
22
23
24
12
13
14
15
16
17
18
10
19
- Ⓡ
#include <iostream>
#include <cmath>
using namespace std;
Eint main()
{
}
float amount;
float interest;
float years;
float total;
cout << "Enter amount to invest (dollars) =>";
cin >> amount;
// Dollars to invest.
// Yearly interest rate.
// Number of years.
// Total accumulation.
cout << "Enter yearly interest rate (0...100) =>";
cin >> interest;
cout <<"Enter the number of years => ";
cin >> years;
interest interest / 100;
total amount pow ((1 + interest), years);
cout << "\n";
cout << "The total accumulation is " << total << " dollars.\n";
return 0;
No issues found
Tel
| x= ab
main()
I
Ln: 17 Ch: 12
SPC
Transcribed Image Text:100 % Output 1 2 3 4 5 25 26 27 28 6 7 8 9 10 11 20 21 22 23 24 12 13 14 15 16 17 18 10 19 - Ⓡ #include <iostream> #include <cmath> using namespace std; Eint main() { } float amount; float interest; float years; float total; cout << "Enter amount to invest (dollars) =>"; cin >> amount; // Dollars to invest. // Yearly interest rate. // Number of years. // Total accumulation. cout << "Enter yearly interest rate (0...100) =>"; cin >> interest; cout <<"Enter the number of years => "; cin >> years; interest interest / 100; total amount pow ((1 + interest), years); cout << "\n"; cout << "The total accumulation is " << total << " dollars.\n"; return 0; No issues found Tel | x= ab main() I Ln: 17 Ch: 12 SPC
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY