Inventory System Help Adjusting the supply

Hello, Ive been working on this inventory for practice for quite some time now and this is the last thing i need to do ive been trying everything i know to get it to work. which is adjusting the supply for each item it works when i dont exit it the program it saves it in the file and everything but when i exit the program after adding the items and then i choose edit inventory it doesnt work it wont save it to the file or anything.
Last edited on
a bug in your control flow is causing your problems

you need to put your code into functions and call those functions (a monolithic block of code is not good programming form, as illustrated by your trouble debugging your code).

you will not (we will not, either) understand your control flow like this

rewrite your code into something like this and your bug will become clear:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void addInventory() {
  // put your implementation here
}

void checkInventory() {
  // put your implementation here
}

void editInventory() {
  // put your implementation here
}

main()
{
  // blah, blah, blah
  switch( choice ) {
    case 1: addInventory(); break;
    case 2: checkInventory(); break;
    case 3: editInventory(); break;
  }
}
Last edited on
Sorry I am very new to c++ and decided to give this project a shot. But thank you very much for the suggestion
Topic archived. No new replies allowed.