6.1.1.One Dimensional Array
When you want to stored many values in a variable, one dimensional array will help you.
Example 1:
#include<iostream.h> #include<conio.h> void main() { int n; float score[10],t_score=0; cout<<"Enter Element of Array: "; cin>>n; cout<<"Input Array_Score\n"; for(int i=0;i<n;i++) { cout<<"Score: "; cin>>score[i]; } cout<<"Output Array_Score\n"; for(int i=0;i<n;i++) { t_score+=score[i]; cout<<"Score: "<<score[i]<<endl; } cout<<"Total_Score: "<<t_score<<endl; getch(); }