General Input Output

char city[10][80];
int n;
do
{
cout<<"Enter the number of strings <=10"<<endl;
cin>>n;
}while(n>10);
for(int c=0; c<n; c++)
{
cout<<"Enter city["<<c+1<<"]:"<<endl;
gets(city[c]);
}
cout<<"The cities are:"<<endl;
for(c=0;c<n;c++)
cout<<"City["<<c+1<<"]:"<<city[c]<<endl;
How are the highlighted lines make sense? anything inside " " is just di/splayed as it is but in this it is acting as the part of an array! :/
cout<<"Enter city["<<c+1<<"]:"<<endl;

don't forget that the " mark is also right after the ' city[ ' thing, so your quotation ends after city :)
Hey thanks for the reply but doesn't the quotation end after '[' in "city[" thing? :)
Topic archived. No new replies allowed.