It is a compiler error.
It says:

base operand of `->' has non-pointer type `pizza'


At 01:33 AM 1/2/2005, you wrote:


--- Hardy Huang <[EMAIL PROTECTED]> wrote:

>
> Hai,
>       I'm trying to use pointer, array and struct
> together. I'm a newbie.
> Here is my code. I still don't know what's wrong
> with it. So guys plz help
> me out.
>
> #include <iostream>
> using namespace std;
> #include <conio.h>
>
> const int nameSize = 20;
> struct pizza
> {
>      char name[nameSize];
>      float diameter;
>      float weight;
> };
>
> int main()
> {
>      cout << "Welcome to William Wingate Pizza
> Analysis Service!\n";
>      cout << "How many pizza do you want to
> make?\n";
>
>      /////////////////
>      int quantity;
>      (cin >> quantity).get();
>      pizza * guest=new pizza[quantity];
>      /////////////////
>
>    
>
///////////////////////////////////////////////////////////
>      for (int i=1; i<=quantity; i++)
>      {
>          cout << "Enter number " << i << " pizza
> statistics!\n";
>          cout << "Enter pizza name     : ";
>          cin.getline(guest[i]->name,nameSize);
>          cout << "Enter pizza diameter : ";
>          cin >> guest[i]->diameter;
>          cout << "Enter pizza weight   : ";
>          (cin >> guest[i]->weight).get();
>      }
>    
>
///////////////////////////////////////////////////////////
>      cout << "\nHere is your pizza statistics!\n";
>    
>
///////////////////////////////////////////////////////////
>      for (int i=1; i<=quantity; i++)
>      {
>          cout << "Pizza number " << i << endl;
>          cout << "Name     : " << guest[i]->name <<
> endl;
>          cout << "Diameter : " << guest[i]->diameter
> << endl;
>          cout << "Weight   : " << guest[i]->weight
> << endl;
>      }
>    
>
///////////////////////////////////////////////////////////
>      getch();
>      return 0;
> }
>
> Thank you and Happy New Year
>
>
>
>
>
>

Hi Binit,

Firstly you didnt mention what problem are you facing
with the code.. (compiler error.. runtime error? )

The loop range you are using is from 1 to <quantity>.
It should be from 0 to <quantity -1>.

Regards
Manik



           
__________________________________
Do you Yahoo!?
Send holiday email and support a worthy cause. Do good.
http://celebrity.mail.yahoo.com





To unsubscribe : [EMAIL PROTECTED]





Yahoo! Groups Links


*************************************************************************
Laughing at our mistakes can lengthen our own life.
Laughing at someone else's can shorten it.      

---Cullen Hightower---
************************************************************************


To unsubscribe : [EMAIL PROTECTED]





Yahoo! Groups Links

Reply via email to