Sunday, August 26, 2018

Running Sum using Pointers in C++

A very simple program that I wrote along time ago while learning C++ programming in my class in one of the university here in Bacolod City. This program will ask the user to give a number and then it will sum up the total numbers using Pointers in C++.

I am currently accepting programming work, it project, school 

programming projects , thesis and capstone projects, IT consulting 

work, computer tutorials and web development work kindly contact me in the following email address for further details.  If you want to advertise in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.com, jakerpomperada@aol.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

My personal website is http://www.jakerpomperada.com


Program Listing

#include<iostream.h>

#include<conio.h>

int main()
{
int array[30];
int sum=0,n=0,*point;
cout << "\t\tRunning Sum Using Pointers";
cout << "\n\n";
cout<<"Enter how many elements ?";
cin>>n;
for(int i=1;i<=n;i++) {
 cout << "\n\n";
 cout << "Enter Value No"
     << i << ":";
cin>>array[i];
point = &array[i];
sum+=array[i];
cout << "\n";
cout<<"The Running Sum is "
    << sum << ".";

}
cout << "\n\n";
system("pause");

}

No comments:

Post a Comment