I would recommend you put your classes into separate files and include the header for each class you want to use. This is some funky formatting and structure.
Spotted a goto too, definitely don't use that. It's strongly discouraged.
I realise this is probably a first attempt at learning how to do C++ but I would recommend reading around on some best practices . Defining a class inside a main is eccentric to say the least .
You need to read through an introductory textbook.
C++ is not a friendly language - learning by hacking something together then asking the internets to debug it for you will lead to neither working software nor the ability to create such.
For example, the int main(); statement here declares the existence of a function called main, which the compiler already knows about because you're writing main() at the time. It doesn't call main. It bears no relation to the new scope created immediately afterwards. The most generous possible interpretation is that you've deliberately written some dead code in the middle of a function.
Code:
int main();
{
petrolPump obj;
int fuelType;
// more stuff cut out here
If you want to learn C++, I'd learn C first, before getting into objects and the standard library as well. Just to understand some basics, e.g. pointers, memory.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.