EBK C++ PROGRAMMING: PROGRAM DESIGN INC
EBK C++ PROGRAMMING: PROGRAM DESIGN INC
8th Edition
ISBN: 9781337669085
Author: Malik
Publisher: VST
bartleby

Concept explainers

Expert Solution & Answer
Book Icon
Chapter 8, Problem 7SA

Explanation of Solution

The program statements have been explained with in-lined comments.

    //declare an array list of 5 elements / components

    double list[5];

    //the elements of the array list are

    //assigned a value of an expression

    //for example if i = 3 then

    //list[3] = pow(3,3) + 3 /2.0 

    //= 27 + 1.5 = 28.5

    for (int i = 0; i < 5; i++)

        list[i] = pow(i, 3) + i / 2.0;

    //the output is formatted to show decimal point

    //and 2 decimal places after the decimal point

    cout << fixed << showpoint << setprecision(2);

    //print on a single line with space separated values

    //all the elements of the list which are

    //0.00 1.50 9.00 28.50 66...

Blurred answer
Students have asked these similar questions
QUESTION: NOTE: This assignment is needed to be done in OOP(c++/java), the assignment is a part of course named data structures and algorithm. A singly linked circular list is a linked list where the last node in the list points to the first node in the list. A circular list does not contain NULL pointers. A good example of an application where circular linked list should be used is a items in the shopping cart In online shopping cart, the system must maintain a list of items and must calculate total bill by adding amount of all the items in the cart, Implement the above scenario using Circular Link List. Do Following: First create a class Item having id, name, price and quantity provide appropriate methods and then Create Cart/List class which holds an items object to represent total items in cart and next pointer Implement the method to add items in the array, remove an item and display all items.   Now in the main do the following Insert Items in list Display all items. Traverse…
Write a function summax2 : int list -> int = that takes an int list and returns the sum of the 2 largest integers in it. 1 # summax2 [1;4;6;2;7;8; 3 ; 10 ; 4; - 1] ; ; 2 - : int = 18 3 # summax2 [1;4];; 4 - : int = 5 5 # summax2 [1]; ; 6 - : int - 1 7 # summax2 []; ; int = 0
Write a function oddfirst : int list -> int list = that takes a int list and returns the same list, but where all odd numbers come before the even numbers. 1 # oddfirst [4;2;7;3;1;0; 9;3;6;-1;0;3];; : int list - 2 - [7; 3; 1; 9; 3; -1; 3; 4; 2; 0; 6; 0] 3 # oddfirst [1;0;0;4;6;1; 2;100; -7;4; -9]; ; int list = [1; 1; -7; -9; 0; 0; 4; 6; 2; 100; 4]
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