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 7, Problem 7.17E

( What Does This Code Do?) What does the following program do?

  1. // Ex. 7.17: Ex07_17.cpp
  2. // What does this program do?
  3. #include <iostream>
  4. #include <array>
  5. Using namespace std:
  6. Const size_t arraySize {10}:
  7. Inst whatIsThis (const array &, size_t); // prototype
  8. Int main ( ) {
  9. Array a{1,2,3,4,5,6,7,8,9,10};
  10. Int result {whatIsThis (a, array Size) };
  11. Cout << “Result is “ << result << end ] ;
  12. }
  13. // What does this function do ?
  14. Int whatIsThis (const array <int, arraySize>& b, size_t size ) {
  15. If (size==1) { // base case
  16. Return b[0];
  17. }
  18. Else { // recursive step
  19. Return b[size-1] + whatIs This(b, size-1);
  20. }
  21. }

Blurred answer
Students have asked these similar questions
c++ : rewrite this code , to be unique .  In which the output will stay same same.   #include <iostream>#include <stdint.h>using namespace std; class arr{private:    int size_arr;            //To store the size of the array    char *begin;             //Pointer for dynamic allocation of memory    int capacity;            //To store the capacity of the elements in the arraypublic:    arr(int n);              //constructor (default) for creating an array    int insert_arr(char x);  //To insert an element x in the array    int remov_arr(int i);    //To remove an element from position i    void display();    void displayAtPos(int i);//Function to display a character at position i}; arr::arr(int n){    size_arr = n;    begin = new char[size_arr];    capacity = 0;} int arr::insert_arr(const char x){    if(capacity >= size_arr){        cout << "Array Full!" << endl;        return -1;    }    begin[capacity++] = x;            //One element is added, so increment the…
Use Array instead of vectors- Implement following classes and required member functions in C++ OOP style. A main function Introduce Movie object first. Then add several Movie objects along with necessary data ( Date, Title, Genre, category etc ) to array of movies. Movie class that has functions to add and delete movies.a. Introduce a searchEvent(by category/title/year etc) which will print out all movies of a specified search. Perform deletion and insertion operations. Introduce sort movies function by year, title and category and display. Introduce private members of your choice and use Setter and/or getter functions extract and modify these data members. Then please make sure you invoke all functions in main function.    Fast answer please
in C++ // praphrase or change this code , while the purpose and output is same  .    #include <iostream>#include <stdint.h>using namespace std; class arr{private:    int size_arr;            //To store the size of the array    char *begin;             //Pointer for dynamic allocation of memory    int capacity;            //To store the capacity of the elements in the arraypublic:    arr(int n);              //constructor (default) for creating an array    int insert_arr(char x);  //To insert an element x in the array    int remov_arr(int i);    //To remove an element from position i    void display();    void displayAtPos(int i);//Function to display a character at position i}; arr::arr(int n){    size_arr = n;    begin = new char[size_arr];    capacity = 0;} int arr::insert_arr(const char x){    if(capacity >= size_arr){        cout << "Array Full!" << endl;        return -1;    }    begin[capacity++] = x;            //One element is added, so increment the…
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
1.1 Arrays in Data Structure | Declaration, Initialization, Memory representation; Author: Jenny's lectures CS/IT NET&JRF;https://www.youtube.com/watch?v=AT14lCXuMKI;License: Standard YouTube License, CC-BY
Definition of Array; Author: Neso Academy;https://www.youtube.com/watch?v=55l-aZ7_F24;License: Standard Youtube License