dimanche 27 mars 2016

if and char statement

hello This is not my entire code but I'm stuck at this where I need to print the information only when the user types the word "NewYork" and when I debug nothing is printed even when I type the word "NewYork" . So can anyone one tell what might be the problem? Thanks

   int main(){

    Panel *panelptr;
int count,len,wid;
double heg;
char locat[30];

cout<<"how many panels do you need to create ? "<<endl;
cin>>count;
panelptr = new Panel[count];
assert(panelptr!=0);



for (int i=0; i< count; i++){
 cout << "Enter the length: ";
 cin >>len;
 cout << "Enter the width: ";
 cin >> wid;
 cout << "Enter the height: ";
 cin >> heg;
 cout<<"Enter the location: ";
 cin >>locat;
 panelptr[i].setPanel(len,wid,heg,locat);
 if(locat == "NewYork")
     panelptr->print();

}


delete [] panelptr;
system("pause");
return 0;
}

Aucun commentaire:

Enregistrer un commentaire