hi i was wondering if this is able to be done?
and if so would this create an array of pointers?
ive tried using this in a program but i get a few errors:Code:int i, total; class house { public: float height; float width; } int main() { cout<<"enter total amount of houses\n"; cin<<total; for (i=0;i<total;i++) { house h[total]; cout<<"enter height\n" cin>>h[i].height; cout<<"enter width\n"; cin>>h[i].width; } for ( i=0;i<total;i++) { house* ph[total]; ph[i]=&h[i]; } return 0;}
cannot convert float* to house* in assignment
invalid operands of type float* and float to binary 'operator<'
non l-value in unary &
invalid operands of type float* and float* to binary 'operator*'
invalid operands of type float and float* to binary 'operator+'
im quite new to c++ and not sure what ive done wrong
thank you in advance
sorry forgot {} and other stuff this code wont compile just want advice on the errors and the pointer concept



LinkBack URL
About LinkBacks


