Im doing my homework and I dont how to seperate sums and remembering the types of numbers?. Its hard to explain.
6 ( How many lines)
1 3 125 45 17 ( The number of the machine, how many numbers there are, how much does it cost)
2 2 45 71
3 2 56 78
4 1 120
2 1 45
3 1 56
are you tracking across lines? eg if you have 2 lines with saws, do you total that up or list saws twice?
anyway, without any containers, this program requires a fair number of variables to do it.
its exactly like you have it, except you need a price for each item (s1, s2, ...)
you can define constants with names via enum:
enum tooltypes{saw=1, cooker, etc}; //they start at 0 by default and add 1 each item. you can reset the counter with = at any point, but for your problem only the first one set to 1 is needed.
its good to use meaningful names. gn means nothing to me. tool_id or something readable is much better, so anyone can understand the code easily without having to unravel the variable names.
I have seen this kind of problem thrown at students right before a container is taught, so you understand why the container makes it easier.
initialize variables where you create them.
int S1{}; //zero
int S2{3}; //3
you don't have to -- you can seed them later in the code all over the place as you did and it works, but its neater to just do it all at one time. That eliminates 11-14 (though, those could be the enum I mention).