Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Can someone tell me what the error is?

+1 vote
asked Feb 25, 2023 by Eidnoxon (5,110 points)
I'm currently learning c++, since I know everything about python, still, I'm learning python data structure too. In c++, I'm learning overloaded functions, everything looks great until I compile it, and there is a bunch of errors I never knew even existed. I watched all over my code, EVEN RE-WRITE IT and still, same error. No semicolons left out, I don't know what's the problem. I tried the same code in another website but then it worked. Here is the source code: https://onlinegdb.com/2dF914tJB ; Please if you can help me I would really be grateful. Have a nice day :D

2 Answers

0 votes
answered Feb 26, 2023 by Peter Minarik (84,720 points)

In the function prototypes (at the beginning of your file) you need to provide the return types as well. Add void before all of your bakePizza function names.

Also, in void bakePizza(string topping_1, string toping_2) implementation (definition) you have a typo, as toping_2 should have 2 'p' in it.

After fixing all of this, your code will compile and run.

Good luck!

commented Feb 27, 2023 by Eidnoxon (5,110 points)
Thank you so much it really means a lot to me! Eventually I found out that I forgot the "void" keyword but I never noticed my typo. Thanks again, I appreciate it!
0 votes
answered Feb 28, 2023 by hamzaking11 (420 points)
Hi i check your source code you missing two things in it .
 Add void in every begning bakepizza like below

void bakePizza();
void bakePizza(string topping_1);
void bakePizza(string topping_1, string topping_2);
void bakePizza(string topping_1, string topping_2, string topping_3);

and other one is spelling mistake in line 24 you type toping which topping as you enter it above line.

i hope this will be worked and you will understand what's i explained.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...