Computers and Technology

A) Pointers, Dynamic allocation and variables DECLARE a regular integer variable 'intVar' and assign it a value of 42.
DECLARE an int pointer variable 'ptrInt'.
ASSIGN the address of intVar to ptrInt.
Cout out the dereferenced value of ptrInt.
ASSIGN to 'ptrInt' using dereferencing(*), the value of '23'.
Cout out the dereferenced value of ptrInt.
DECLARE an int poiner Variable ptrInt2.
Assign dynamically allocated 'new int' to ptrInt2.
ASSIGN to prInt2 using dereferencing, the value of '42'.
Cout the dereferenced value of ptrInt2.
(Run the code to be sure it work, turn-in the code and screen prints)
B) Pointers and arrays
DECLARE two pointer variables of type int named: intArray and copyIntArray
Dynamically (new int[#]) create an array of 100 integers and ASSIGN(=) the address to intArray
Write a for loop to assign the index( 0 to 99) of 'intArray' to be the value of the array
Write a for loop to cout the values of each element in the 'intArray' array.
ASSIGN just the address of 'intArray' TO 'copyIntArray'.
Write a for loop to cout the values of each element in the 'copyIntArray' array.
Deallocate the intArray and copyIntArray.
(Run the code to be sure it work, turn-in the code and screen prints)
Summary of what you learned.
C) Pointers and classes.
Given the class definition of a Watch.
Write the body for each of the public functions.
class Watch{
public:
Watch(int, int, int);
Watch();
int hour();
int minute();
int second();
void tick();
void reset(int, int, int);
private:
int hour_;
int minute_;
int second_;
};
DECLARE a pointer variable named myWatch, using the 'Watch' class/datatype.
Using the variable myWatch, dynamically DECLARE(new Watch) and ASSIGN (=) a Watch ... to myWatch.
Assign a value of 12 to hours, a value of 30 to minutes and a value of 0 to seconds.
Write a cout statement to print out (cout) the values hour, minutes and seconds in the format hh:mm:ss (e. g., 12:30:00).

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:30, mikey3882
When creating a budget, log fixed expenses before income. after income. after savings. at the top.
Answers: 1
image
Computers and Technology, 23.06.2019 04:31, manlyman31
Selling a product through an electronic medium is
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, alannaamarriee
Jace needs to answer a question on square roots to win a quiz. how can he use a spreadsheet to find the square root of 786? a. use the functions round and count b. create a table and chart c. use the function sqrt d. use the function now
Answers: 3
image
Computers and Technology, 23.06.2019 18:30, emmaishere69
List 3 items that were on kens resume that should have been excluded
Answers: 1
Do you know the correct answer?
A) Pointers, Dynamic allocation and variables DECLARE a regular integer variable 'intVar' and assig...

Questions in other subjects: