using Dev C++4
user can enter names of cities and temps,
but when it output city names i get garbage but
temps are fine.
struct Cities {
char city[];
int temp;
};
void input_names(Cities info[], int numb_cities) {
for(int t=0;t<numb_cities;t++) {
cout<<"\n\n";
cout<<"please enter name of city#"<<t+1<<": ";cin>>info[t].city;
cout<<"\nplease enter temp of city "
<<info[t].city<<": ";
cin>>info[t].temp;
}
cout<<"\n\n";
for(int t=0;t<numb_cities;t++) {
cout<<info[t].city<<" "<<info[t].temp<<"\n";
}
}//close input_names;
void main() {
int n,
numb_cities=10; //number of cities
void input_names(Cities[], int);
Cities info[numb_cities];
input_names(info, numb_cities);
}
--------------------------------------------------
remove *batSPAM* to e-mail me
--------------------------------------------------