array question

This is incomplete program. My compiler show.[Error] invalid types 'int[int]' for array subscript. What does it means? I think i have something wrong with the input array.Someone help?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
  #include <iostream>
using namespace std;
int main()
{	string name,choice;
	int age, counter,Aage,high,low;
	string Lname,Hname;
	double SumAge;
	SumAge = 0;
	counter = 99999;

	do 
	{
	for(int i=0;i<=counter;i++)
	{
	
	cout<<"enter name ";
	cin>>name[i];
	cout<<"enter age ";
	cin>>age[i];
	
	cout<<"press any character to continue or end to terminate";
	cin>>choice;
}
	}while (choice!="end");




//	 cout<<"the average age is "<<Aage<<endl;
//	cout<<"the lowest age is "<<low<<endl;
//	cout<<"he/she is "<<Lname<<endl;
//	cout<<"the highest age is "<<high<<endl;
//	cout<<"he/she is "<<Hname<<endl;




	return 0;
}
Last edited on
cin >> age[i]; illegal age is not an array

also don't forget
#include <string>
Topic archived. No new replies allowed.