I have wrote this program to calculate the 5 elements of an array..
could someone tell me (if it is) a way to calculate mora than 4 elements,,lets say the array have 100 elements..Code:#include <iostream.h> #include <stdlib.h> #include <iomanip.h> using namespace std; int main(int argc, char *argv[]) { int n[5],i; for(i=0;i<5;i++) { cout<<"Value for n["<<i<<"]:"; cin>>n[i]; } for(i=0;i<5;i++) { cout<<i<<":"<<n[i]<<endl; } int sum=n[0]+n[1]+n[2]+n[3]+n[4]; cout<<"The sum is:"<<sum<<endl; system("PAUSE"); return 0; }
Thanks in advance!