Hi guys, am trying to learn c++... but this code is giving me a strange error..
([Error] name lookup of 'i' changed for ISO 'for' scoping [-fpermissive] )
can some one help me to correct it..
Thanks in advance.. God Bless u all.
for (int i=0; i<=num; i++)
cout<<"Enter dish name and price: ";
Since the second line is not part of the loop i is undefined.
In pre-standard C++ when initializing a variable in the initialization section of a for(;;) loop the variable was actually initialized as being before the loop. In standard C++ this variable is contained within the loop and goes out of scope at the end of the loop.
I think you need to review how classes work. You have created three instances of your class but you only initialize the values in one of these instances (order). All the values in bill and show are uninitialized. You probably only want one instance for this assignment.