Question: It's C++ programming need help. The question is Expand last weeks program by making the greeting function expect anargument indicating the name of the

It's C++ programming need help.

The question is " Expand last weeks program by making the greeting function expect anargument indicating the name of the person to be greeted"?

The code is below and the assginment.

#include #include #include using namespace std;

//Create a program that randomly chooses between 3 possible greetings

int main() { //sets variable int new_greeting; //set three greetings into array string Exuberant_greeting[3] = {"Resistance is futile.", "Heeeeere's Johnny!", "Hello, my name is Inigo Montoya. You killed my father. Prepare to die!"}; do { srand(time(NULL)); //seed random number //chooses one of the three greetings randomly int random_greeting = rand() % 3;

//outputs results cout

It's C++ programming need help. The question is " Expand last weeks

15 Parameters Key terms: parameter Reading: Tutorialspoint's C++Functions6 Exercise: Expand last week's program by making the greeting function expect an argument indicating the name of the person to be greeted The constraint of specifying the inputs that a function expects defines the set of cases in which it can operate. This input takes the form of an ordered list of parameters, or arguments. Each one is defined by its name, and the type it is expected to take. These names become part of the function's scope and are not meaningful elsewhere. They do not need to be defined outside the function declaration. #include // given a radius, we calculate a sphere' s volume float calculate_sphere_volume float sphere_radius return MPI pow sphere_radius, 3 ) *4/3 /I find the volume of a favorite sphere main) float sphere_radius_m -10.0 float sphere_volume_m3-calculate_sphere_volume sphere_radius_m) Until you learn about pointers, references to memory addresses, all your parameters will be "passed by value."This means the called function will get its own copy of the data and cannot directly change any value at the caller. C and C++ use a technique called "pointers" to make a function see the same copy of the data. The other way for a called function to influence local variables is for it to return a value

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!