Question: CPS 1 1 9 2 Computer Programming II Programming Assignment # 3 Max Points: 4 0 Objective: The objective of this exercise is to gain
CPS Computer Programming II
Programming Assignment #
Max Points:
Objective: The objective of this exercise is to gain experience with:
Pointers and Memory
Fill in answers to all of the questions. For some of the questions you can simply copypaste appropriate text from the terminaloutput window into this document. You may discuss the questions with your instructor.
Use IDE preferably Microsoft Visual Studio for this Programming Assignment
Name:
Part #: Pointers and Pointer Arithmetic
points
What type of data does a pointer store? point
What information tells us the amount by which a pointer will increment? point
What will cout ptr ptr endl; print? What is the difference between ptr and ptr in that line of code? point
What is the output from the following statement: point
int primes; int ptr primes;
ptr ;
cout ptr endl;
The output written to cout is:
What is the output from the following statement: point
int odds;
int ptr &odds;
cout ptr endl;
The output written to cout is:
What is the output from the following statement: point
int odds;
int ptr &odds;
ifptr
cout ptr endl;
else
cout ptr endl;
The output written to cout is:
What is the output from the following statement: point
int odds;
int primes;
int ptr &odds;
int ptr ℙ
if ptr ptr
cout ptr endl;
else
cout ptr endl;
The output written to cout is:
Part #: Code Analysis
points
What input would make lead the program myProgram to output Pass points
What will the program print? points
What will the program print? points
Part #: Using Pointers to Iterate Loops
points
Program: In this lab, the goal is to write a program that utilizes points to traverse an array of numbers specified by a user. The program will get a set of numbers from standard input. It should use pointers to insert the numbers into the array and then use pointers to traverse the array in reverse while printing the memory address and the factors of the number located at that memory location to which it points. A sample output is provided. The memory address and the evenodd should be comma separated and printed to standard output.
The program will:
Read one commandline argument: the number of elements in the array point
Example, the following command would ask the user for numbers:
PA
Insert the numbers entered by the user into an integer array using pointers. points
Traverse the list in reverse using pointers. points
Print the value at the memory address to which it points and then print the factors of the value at the memory address to which it points sample output below points
SAMPLE OUTPUT:
NOTE: Operating on the array without using pointers will NOT receive partial credit.
Submit to DL
The document must be submitted as a PDF
The code must be submitted cpp
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
