Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

computer science programming

For this assignment, prepare two related programs as .cpp files and submit them in a single zipped file.

Program #1 Instructions:

  1. Write a simple program to validate passing by value and passing by reference.
  2. Initialize a variable and display its value.
  3. Pass the variable by value to a function. Change the value of the variable in the pass by value function. Display the modified value inside the function.
  4. After the pass by value function returned, display the value again in the main function.
  5. Pass the same variable, now passing by reference to another function. Change the value of the variable in the pass by reference function. Display the modified value inside the function.
  6. After the pass by reference function returned, display the value again in the main function.
  7. See the sample code below for an example of how your program output should look:

Variable name has the value "Barry"

calling pass by valueParameter now has the value "Thomas"

pass by value returnedVariable name has the value "Barry"

calling pass by referencesParameter now has the value "James"

call by reference returnedVariable name has the value "James"

  1. Name the project: PassingByValueReference.cpp

Program #2 Instructions:

  1. Write another simple Address program to print the value of the memory addresses of the variables listed below:
    • a char
    • a string
    • an array of integers
    • an integer
    • a double
  1. See the sample code below for an example of how your program output should look:

Integer has memory address 0x434232String has memory address 0x434234Array has memory address 0x434320Array[1] has memory address 0x434322Array[2] has memory address 0x434324Array[3] has memory address 0x434326etc...etc...

  1. Name the project: Address.cpp

Place your two .cpp files in a single zipped folder.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question