Create two integer variables x and y and an integer array z

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

Problem 1. (Basic Pointers and Pointer Arithmetic) Write a program that will do the following:

1. Create two integer variables x and y, and an integer array z[5]

2. Set the variable x equal to 5, and the variable y equal to 10

3. Save the following values in the array: 1, 2, 4, 8, 16

4. Print to screen the address of each of the variables, x, y, and the start of the array z

5. Create a pointer named testPtr and point it to the variable x

6. Print to screen the value stored in variable x using only your pointer testPtr

7. Add six to the value stored in x using only your pointer testPtr

8. Print to screen the value stored in variable x using only your pointer testPtr

9. Test to see if the value stored in variable x is larger than y, using only the variable y and the testPtr. If it is, print to screen "x > y", otherwise print "y < x"

10. Now, change testPtr to Point to the first entry of the array z

11. Using only testPtr, use a counter and for loop to print all the value in the array (do not use the array).

Problem 2. (Pointers and Functions)Write a void function called swap that accepts as inputs two integer variables and swaps their values. For example, if I had a variable a = 5 and b = 10, after calling swap with variables a and b; a = 10 and b = 5. Note this will require writing the function such that it uses pointers since we want to change the original variables and return nothing (void).

Reference no: EM13869620

Questions Cloud

How is the artist employing line quality : How is the artist employing "Line Quality"? Orientation: Horizontal, Vertical, Diagonal, Curved? Direction: refers to implied movement of a line. Line weight can accentuate direction. Degree of Continuity: (or linear flow) can enhance direction. Medi..
What does gdp tell us? : What does GDP tell us?
What is inflation? what are the causes of inflation? : What is inflation? What are the causes of inflation?
Bookstore stock to achieve highest expected value : The University of Miami bookstore stocks textbooks in preparation for sales each semester. It normally relies on departmental forecasts and preregistration records to determine how many copies of a text are needed. Based on the given information, Vai..
Create two integer variables x and y and an integer array z : Create two integer variables x and y, and an integer array z[5]. Set the variable x equal to 5, and the variable y equal to 10. Save the following values in the array: 1, 2, 4, 8, 16
Employer and prospective employee but without stating salary : An employment contract that is offered to a job prospect although signed by both employer and prospective employee but without stating the salary is
Define the health care equipment : Health care equipment
Difference between lean six sigma green belts-black belts : What is Lean Six Sigma? Describe the difference between Lean Six Sigma Green Belts, Black Belts, and Master Black belts. Using any resource available (internet, textbook, magazine) explain the process of obtaining these certifications. Do you feel th..
What are both procedural and substantive due process : What are both Procedural and Substantive Due Process? What is Strict Scrutiny and when do the courts use it?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Find the prime numbers

Write a c++ program to find the prime numbers

  Write a program that reads two separate integers from user

Write a single-file program (named main.cpp) that reads two separate integers from the user, adds them together, and then outputs the answer.

  Write a program that creates an arraylist

Write a program that creates an ArrayList and adds a Loan Object, a Date Object, a string, JFrame object, and a circle object to the list, and use a loop to display all the elements in the list by invoking the object's toString() method.

  1 recursive sorts are easier to write in functional style

1 recursive sorts are easier to write in functional style than others. two recursive sorts are quicksort and mergesort.

  A linked list of your song structure in cd

The CD object should have a data member that is a linked list of your song structure that you have in CD.  The CD class needs a function that allows it to add a song to the object, that function would then append the song to that instance of the link..

  Heights of the individual pupils

Make a C++ program that helps the health visitor making the statistics and heights of the individual pupils,

  Write a function named digit_name

Write a function named "digit_name" that takes an integer argument in the range from 1 to 9 , inclusive, and prints the English name for that integer on the computer screen.

  Create a bitoutputstream

Implement a class named BitOutputStream, as shown in Figure for writing bits to an output stream. The writeBit(charbit) method stores the bit in a byte variable. When you create a BitOutputStream, the byte is empty

  Evaluate the tip amount that should be added

Write a program that will be used to evaluate the tip amount that should be added to a restaurant charge. Allow the user to input the total, before taxes and the tip percentage (15% or 20%).

  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,

  Display the largest and smallest numbers entered

Design a java program with a loop that lets the user enter a series of numbers - After all the numbers have been entered, the program should display the largest and smallest numbers entered.

  Implement a class called hugeinteger

Using your own Linked List implementation (see attached), implement a class called HugeInteger that represents arbitrary sized integers and supports addition only. You may only use the tools that have introduced in class, and you MAY NOT use Java'..

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