Hi, This program is supposed to ask the user how many numbers they want to sum up and then take all the numbers one by one to give the final result. Its working but perhaps you all professional programmers will point out some flaws in it.
#include <iostream>
using namespace std;
int main()
{
int x,sum=0,count;
int* ptr;
cout<<endl<<"How many numbers?"<<endl;
cin>>x;
ptr=new int[x];
for(count=1;count<=x;count++)
{
cout<<endl<<"Enter "<<count<<"th number:";
cin>>*ptr;
sum+=*ptr;
}
cout<<endl<<sum;
return 0;
}
Thanks for your time.