Improvemented program

Assignment Help C/C++ Programming
Reference no: EM13762120

What does this program do and would you improve it?

//What does this program do?

#include <iostream>

using std::cout;

using std::endl;
int whatIsThis ( int [], int); //function protoype
int main()
{

const int arraySize = 10;

int a [arraySize] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int result = whatIsThis (a,arraySize);
cout << "Results is " <<result << endl;

return 0; //indicates successful termination

} // end main
//What does this function do?

int whatIsThis ( int b[], int size)

{

if (size == 1) // base case

return b [0];

else // recursive step

return b [size-1]+ whatIsThis (b, size - 1);

} // end function whatIsThis

Reference no: EM13762120

Questions Cloud

What is the act''s major significance : What difficulty is presented when an insanity defense is pleaded? How as this affected by the 1984 Insanity Defense Reform Act? What was the catalyst for passage of this Act, and what is the Act's major significance?
Terrie moffitt''s two-path biosocial theory of criminality : How do societal expectations, in combination with early-age biological maturity, contribute to the possibility of juvenile delinquency? According to Terrie Moffitt's two-path biosocial theory of criminality, why do some juvenile delinquents become li..
Define what is displayed on a computer screen : Computer users may encounter situations in which they can best express a computer-related problem or solution by showing the audience a graphic or video representation of what is displayed on a computer screen.
Dilutive eps of wonderful incorporation : The common stock of the company is selling in the stock exchange at $10 each. If Wonderful has 29,000 shares of common stock outstanding throughout the year and its Net Income is $12,000 after paying the preferred dividends, what will be the dilut..
Improvemented program : What does this program do and would you improve it?
Applications of the scientific method : Evaluate (XTATB), (BTB), and (BTB - XTATB).
How can we maintain anonymity and confidentiality : How can we maintain anonymity and confidentiality in the research process? What does it mean to maintain voluntary informed consent? What is a freedom from risk of harm?
Prepare an office memorandum : You are a paralegal working in Plentibux & Moore, a boutique Richmond, Virginia law firm that specializes in white-collar criminal defense. The senior partner in the firm, Bob Plentibux calls you in to his office and tells you that he has a hot issue..
Think of situations when organization development : Can you think of situations when Organization Development (OD) values might be appropriately violated in a consulting engagement?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Develop a two dimensional interactive game

The player starts as a disk, but can "morph" (that is expand and contract) in selected directions

  Design a simple game of blackjack

Prepare a simple game of blackjack using object oriented programming.

  Prepare a table showing loan amount

Write a C++ program that prints a table showing loan amount, interest rate, length of loan, monthly payments, and total cost of a mortgage.

  Prepare a program to palindrome function.

A palindrome is a string whose reversal is identical to the original string.  How many strings using decimal digits (0,1,2,.....,9) of length n are palindromes?

  Write function named enough that takes one integer argument

Write a function named "enough" that takes one integer argument, call it "goal" and returns as its value the smallest positive integer n for which 1+2+3+. . . +n is at least equal to goal .

  Write a c++ program that would take two 3x3 matrix

Write a C++ program that would take two 3x3 matrix and outputs the results of adding, subtracting and multiplying two matrices. Create at least three functions: one that performs addition,

  What are the contents of the array

What are the contents of the array after the subsequent loops complete - loops and also provide the iteration how to get it.

  Create an employee class

Create an employee class, including two data: an employee number (type int ) and the employee's compensation (in dollars; type float). The member data should comprise an int for storing the employee number and a float for storing the employee's co..

  Write a program that tells what coins to give out

Write a program that tells what coins to give out for any amount of change from 1 to 99 cents.

  Techniques for information hiding and encapsulation

What techniques did you utilize for information hiding and encapsulation? Are there any improvements you would make? If so, what would they be?

  Provide a class diagram for every user authored class

Examine the sample code you have been provided with. This code is for a simple Car Hire management system. It contains a number of classes.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd