Assignment No. 5 (CLO-3) : Programming Fundamentals 19-EE-116 Department
Assignment No. 5 (CLO-3) : Programming Fundamentals 19-EE-116 Department
Assignment No. 5 (CLO-3) : Programming Fundamentals 19-EE-116 Department
5 (CLO-3)
Subject: Programming Fundamentals (CS-1233)
Name: haroon- malik ; section: d; REG NO: 19-EE-116
Department: electrical engineering
Submitted to: dr. qamas gul
Date: 05-09-2020
Q. No. 1: Analyze and outline the following problem statement into the C++
program using Pointers.
a) Write a program that reads a group of numbers from the user and places them in an array of type float.
Once the numbers are stored in the array, the program should average them and print the result. Use
pointer notation wherever possible.
ANSWER:
#include <iostream>
int main()
do
while(ch != 'n');
total += *(flarr+k);
return 0;
Output:
Source File:
assign 5.cpp
b) State whether the following are true or false. If false, explain why.
I) Two pointers that point to different arrays cannot be compared meaningfully.
II) Because the name of an array is a pointer to the first element of the array, array names can be
manipulated in precisely the same manner as pointers.
Answer:
I) True
II) False, an array name cannot be used to refer to another location in memory.