I need help with my program

I want my program to retain the remaining stock when I buy again. How should i do it?

The only thing working there is the Candies & Snowbear, because im not done putting all the data needed in my program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include<iostream>
#include<string>
using namespace std;
int main ()
{
	//strings
	string products;
	string candies;
	string again;
	
	//strings
	
	//array
	int arr[] = {100, 50, 50};
	
	//array
	
	
	
	//initialization
	int Snowbear = 1;
	int Judge = 1;
	int Mentos = 3;
	int hm;
	int m;
	int rpt;
	//initialization
	
	
	
	
	//First Part
	cout<<"Sari-sari Store"<<endl<<endl;
	cout<<"Choose a product: \n Candies \n Soft Drinks \n Junk Foods"<<endl<<endl;
	cout<<"Enter your choice: ";
	getline (cin, products);
A:	cout<<"Candy Stock: "<<arr[0];
	//First Part
	cout<<endl;
	//Second Part
	
			if (products != "Candies" && "Soft Drinks" && "Junk Foods" && 'A')
		{
			cout<<"Error !"<<endl<<endl;
			return 0;
		}
	
	 
			cout<<"Choose a candy: \n Snowbear = Php 1.00 \n Judge = Php 1.00 \n Mentos = Php 3.00"<<endl<<endl;
			cout<<"Enter your choice: ";
			cin>>candies;
			
	
				
			cout<<"How many: ";
			cin>>hm;
			cout<<endl<<endl;
			cout<<"Enter the amount of your money: ";
			cin>>m;
			
			
	
			if (candies == "Snowbear")
				{
					cout<<"Change: Php "<<m-(Snowbear*hm)<<".00";
					cout<<endl;
					cout<<"Candy Stock Left: "<<arr[0]-hm<<endl<<endl;
				}
		
					
				
		
		
					if (products == "Candies")
					{
					cout<<"Buy again: \n Yes \n No"<<endl;
					getline (cin, again);
					cout<<"Enter your choice: ";
					cin>>again;
					cout<<endl<<endl;
					if (again == "Yes")
						{
							goto A;
						}
					
					else if (again == "No")
						{
							cout<<"Thank You for buying ! ";
							return 0;
						}
					}
Hi, kramsuiluj.
Is this an assignment? Are you learning C++ by yourself?
The usage of goto is not encouraged nowadays, there are alternatives that many people consider better (far better!), like for, while and do-while.
Before giving you any help, I think we’d better know what you have studied so far and if this is an assignment or not (we usually give little help on assignments because people are supposed to solve them by their own).
I am a college student so, this was my program for the finals of first semester, because we are tasked to make a program and to use what we've learned, mostly if,else if,for,arrays, but im not that good in looping, so i got a failed grade (a grade of 70 to be specific) i remember posting here about my program, on the of the day of presentation morning and afternoon was my presentation. So my program have lots of issues so i wasn't able to get a passing grade.
Our instructor only focused on for loop so im not really familiar with while and do-while, its also used for looping right?
And about the (goto) i found it online,

Just tryin to perfect my program and want to learn more, so thats it, you guys can tell me anything, I will really appreciate all the help i can get
Topic archived. No new replies allowed.