A small question in strings...

Hello guys
this question gave me a syntax error
can anyone tell me how to write it in the right way ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# include <iostream>
# include <string>
using namespace std;
struct name
{
	string sentence ;
} ;
int main ()
{ 
	name array [100] ;
	int counter = 0 , index [1000] ;
	while (counter < 2 && getline (cin , array[counter].sentence ))
	{
		counter ++ ;
		index [counter] = array[counter].sentence.length ;
	}
      
	system ("pause");
}
next time post exact error here!

index [counter] = array[counter].sentence.length ; should be index [counter] = array[counter].sentence.length();
ok
thx
a lot
Topic archived. No new replies allowed.