subject

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).

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:30
Avariable definition defines the name of a variable that will be used in a program, as well as
Answers: 3
question
Computers and Technology, 22.06.2019 23:50
List a few alternative options and input and output over the standerd keyboard and monitor. explain their functioning in details.
Answers: 2
question
Computers and Technology, 23.06.2019 11:00
This chapter lists many ways in which becoming computer literate is beneficial. think about what your life will be like once you’re started in your career. what areas of computing will be most important for you to understand? how would an understanding of computer hardware and software you in working from home, working with groups in other countries and contributing your talents.
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
Which of these is a benefit of using objects in a powerpoint presentation? a. collaborators can create the external files while you create and edit the slide show. b. you can easily change the theme and design of the presentation. c. you can have older data in the source file while having up-to-date data in the presentation. d. collaborators can easily share the presentation.
Answers: 2
You know the right answer?
A) Pointers, Dynamic allocation and variables DECLARE a regular integer variable 'intVar' and assig...
Questions
question
Mathematics, 24.02.2021 01:20
question
Mathematics, 24.02.2021 01:20
question
Medicine, 24.02.2021 01:20
question
Mathematics, 24.02.2021 01:20
Questions on the website: 13722367