Adding parameters

closed account (y05iz8AR)
Thank you all for helping.
Last edited on
use code tags. I dont even look at code or the question that is 10+ lines of code not in code tags
Last edited on
closed account (y05iz8AR)
do you mean comments?
no. You'll need to surround your code with code tags so the parser can corrctly format the data to be sent to your browser. Look on the right you'll see a box called format. The first button on the left is the code tag button. Press this and it will insert code tags into your code, where you paste your code between. If you do this correctly, it comes out like this:

1
2
3
4
5
6
7
#include <iostream>
int main()
{
    std::cout<<"Hello World"<<std::endl;

    return 0;
};


As far as adding additional parameters, its really hard to do this after you have created your program, especially if everything is hard-coded as it is here.

Last edited on
closed account (y05iz8AR)
sorry about that i didn't know it. Any way is like impossible to add parameters here without making major changes to the code
each function is outputting pretty much the same thing with a little change here and there. This indicates that you are doing something wrong. You ahve a program with 400 lines of code that could be condensed down to maybe 50ish, making it easier to read, easier to find bugs, easier to change. For example all your "food items" could be condensed down in one function.

func define with params
1
2
3
4
int func(int param1, std::string param2){
    ...
   return some_int;
}


func call
1
2
3
4
int a = 0;
std::string s = "stringer";

func(a, s)
Last edited on
closed account (y05iz8AR)
I'll try it that way and see. Thank You all.
Topic archived. No new replies allowed.