LAB 1 Solution
LAB 1 Solution
TASK 1Compile all sample programs and get familiar with pointers. Done
TASK 2 Create a C++ program to find the sum of 5 numbers using pointers
#include "stdafx.h" #include<iostream> using namespace std; int _tmain(int argc, _TCHAR*
argv[])
{ int a=2,b=4,c=6,d=6,e=6;
int *p1,*p2,*p3,*p4,*p5;
p1=&a; p2=&b; p3=&c; p4=&d;
p5=&e; int x; x=*p1+*p2+*p3+*p4+*p5; cout<<x;
system ("pause");
return 0; }
TASK 5 Create a C++ program to find the largest number from the array of 7 numbers
using pointer
#include "stdafx.h" #include<iostream>
using namespace std;