.exe stops executing at the point of main function

I've tried to compile and run this on my dev c++ which is the latest version of the orwell dev c++ 5.11. Well, I tried to run this online using cpp.sh and it worked very well but not here in my laptop so i don't really know where the error is coming from.
I've also read some articles talking about memory leak so i "tried" to patch that up but i'm not an expert that's why i'm asking it here because i know that there are lots and lots of experts out there and i hope any one of you could help me fix this pleasee.
Any solution/s would be delighting.
Here's the whole code
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
  #include <iostream>
#include <cctype>
#include <iomanip>
#include <map>
#include <cstdlib>
#include <sstream>
#include <fstream>
using namespace std;
struct thing{
	map<int,string> Desc;
	map<int,double> p;
	map<int,int> quan;
	map<int,int> q1;
	map<int,int> s;
}thug;
class CS {	
		private:
			map<int,string> Description;
			map<int,double> price;
			map<int,int> quantity;
			map<int,int> quan1;
			map<int,int> sust;
		public:
			void getdesc();
			void getprice();
			void getquan();
			void getq1();
			void getsust();
			void setdesc(map<int,string> Description);
			void setprice(map<int,double> price);
			void setquan(map<int,int> quantity);
			void setquan1(map<int,int> quan1);
			void setsust(map<int,int>sust);
			void cs1();
			CS();
	};


struct vars {
	string user, user1, pass, pass1, item;
	char mainOpt;
	double sum;
	char c;
	int num, STOCKS, stock;
	int numOfOrder[2];
	int quantity[10];
} VARS;
class stocks {
	public:
		void PrintReceipt(double sum);
		void Login();
		void Menu();
		void Menu1();
		void Products();
		void Products1();
		void SearchItem();
		void deleteItem();
		void addquan();
		void openFile();
		void Itemchange();
		void Pricechange();
		void ItemConfig();
		void priceChange();
		//void LOAD();
		//void POSITION(int x, int y);
};




Last edited on
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
void CS::getdesc() {
	thug.Desc[0]="Cherry Mobile Alpha Luxe 8GB(White)";
	thug.Desc[1]="Nokia Lummia 530 4GB(White)";
	thug.Desc[2]="Kata M2 16GB(White)";
	thug.Desc[3]="Nokia X 4GB(Red)";
	thug.Desc[4]="Apple MacBook Air 4GB Intel Core i5 13.3\"";
	thug.Desc[5]="Acer Aspire E5-473-56YB 14\" 4GB";
	thug.Desc[6]="Lenovo A700 Plus 16GB (Black)";
	thug.Desc[7]="Meizu M2 Note 16GB (Grey)";
	thug.Desc[8]="Mi 4i 16GB Gray";
	thug.Desc[9]="Samsung Galaxy Note 5 32GB (Gold)";
	thug.Desc[10]="Asus Zenfone 2 Laser ZE500KL 16GB (Red)";
	thug.Desc[11]="Samsung Galaxy J1 4GB (White)";
	thug.Desc[12]="Asus Zenfone 2 ZE551ML 16GB (Red)";
	thug.Desc[13]="Acer Liquid M220 4GB (Black)";
}



void CS::getprice() {
	thug.p[0]=2999;
	thug.p[1]=2990;
	thug.p[2]=5999;
	thug.p[3]=2990;
	thug.p[4]=46999;
	thug.p[5]=29000;
	thug.p[6]=7999;
	thug.p[7]=6990;
	thug.p[8]=9799;
	thug.p[9]=36990;
	thug.p[10]=7695;
	thug.p[11]=4849;
	thug.p[12]=9995;
	thug.p[13]=2490;
}


void CS::getquan() {
	thug.quan[0]=20;
	thug.quan[1]=20;
	thug.quan[2]=100;
	thug.quan[3]=100;
	thug.quan[4]=70;
	thug.quan[5]=70;
	thug.quan[6]=70;
	thug.quan[7]=70;
	thug.quan[8]=70;
	thug.quan[9]=70;
	thug.quan[10]=70;
	thug.quan[11]=70;
	thug.quan[12]=70;
	thug.quan[13]=70;
}


void CS::getq1() {
	thug.q1[0]=20;
	thug.q1[1]=20;
	thug.q1[2]=100;
	thug.q1[3]=100;
	thug.q1[4]=70;
	thug.q1[5]=70;
	thug.q1[6]=70;
	thug.q1[7]=70;
	thug.q1[8]=70;
	thug.q1[9]=70;
	thug.q1[10]=70;
	thug.q1[11]=70;
	thug.q1[12]=70;
	thug.q1[13]=70;
}


void CS::getsust() {
	thug.s[0]=5;
	thug.s[1]=5;
	thug.s[2]=50;
	thug.s[3]=50;
	thug.s[4]=25;
	thug.s[5]=25;
	thug.s[6]=25;
	thug.s[7]=25;
	thug.s[8]=25;
	thug.s[9]=25;
	thug.s[10]=25;
	thug.s[11]=25;
	thug.s[12]=25;
	thug.s[13]=25;
}


void CS::setdesc(map<int,string> Description) {
	map<int,string>::iterator it;
	for (it=thug.Desc.begin(); it!=thug.Desc.end(); it++) {
		Description.insert(pair<int,string>(it->first,it->second));
	}
}

void CS::setprice(map<int,double> price) {
	map<int,double>::iterator it;
	for (it=thug.p.begin(); it!=thug.p.end(); it++) {
		price.insert(pair<int,double>(it->first,it->second));
	}
}

void CS::setquan(map<int,int> quantity){
	map<int,int>::iterator it, i;
	for (it=thug.quan.begin(); it!=thug.quan.end(); it++) {
		quantity.insert(pair<int,int>(it->first,it->second));
	}		
}

void CS::setquan1(map<int,int> quan1) {
	map<int,int>::iterator it, i;
	for (it=thug.q1.begin(); it!=thug.q1.end(); it++) {
		quan1.insert(pair<int,int>(it->first,it->second));
	}
}

void CS::setsust(map<int,int>sust){
	map<int,int>::iterator it, i;
	for (it=thug.s.begin(); it!=thug.s.end(); it++,i++) {
		sust.insert(pair<int,int>(it->first,it->second));
	}
}

void CS::cs1() {
	getdesc();
	getprice();
	getquan();
	getq1();
	getsust();
}
CS::CS() {
	cs1();
	setdesc(thug.Desc);
	setprice(thug.p);
	setquan(thug.quan);
	setquan1(thug.q1);
	setsust(thug.s);
}



	int STOCKS=14;
	int n, counter=0;
	int stock=14;
	int char_ticker=0;
	CS MAPS;


int search (int number) {
	int n;
	for(int i=0;i<STOCKS;i++) {
		  	if (number==i+1){
		  		cout << i+1 << "   " << thug.Desc[i] << "   " << thug.p[i] << endl;
		  		n=1;
		  		break;
			  }
		  	else n=-1;
	}
	return n;
}
bool operator==(const string str, double number) {
    stringstream ss(str);
    double strAsInt;
    ss>>strAsInt;
    return (strAsInt == number);
}
bool operator==(string str1, const string str) {
    return (str == str1);
}	


//function for making a file and storing the data
void stocks::openFile() {
 ofstream DataOutput;
 DataOutput.open("file.txt", ios_base::app);
 DataOutput << "User: " << VARS.user;
 for (int i=0; i <counter;i++){
  DataOutput << "\nStocks sold " << thug.q1[VARS.numOfOrder[i]-1] - thug.quan[VARS.numOfOrder[i]-1]
       << "  " << thug.Desc[VARS.numOfOrder[i]-1]
       << "\nStock No.: " << VARS.numOfOrder[i]
       << "\nInventory left for this item: " <<  thug.quan[VARS.numOfOrder[i]-1];
   }
   if (STOCKS>stock) {
   	DataOutput << "New items:\n";
   	for (int i=stock;i<STOCKS;i++) {
   		DataOutput << i+1 << thug.Desc[i] << "   " << thug.p[i] << "   " << thug.quan[i] << "\n";
	   }
   }
    DataOutput  << "Total Amount of the day: Php " << VARS.sum;
 DataOutput.close();
}


void stocks::Login()
{ 
 string user="\0", pass="\0";
 cout << "Please enter login details\n"
      << "Enter username: ";
	  cin >> user;
 
 cout << "Enter password: ";
 cin >> pass;
 
 system("cls");
 
  
 if (user=="Admin" && pass=="admin"  ) {
  //system ("cls");
    MAPS.cs1();
  //LOAD();
  Menu1();
 }
 else if (user=="Cash" && pass=="cash")
  {
  //system ("cls");
    MAPS.cs1();
  //LOAD();
  Menu();
  }
 else
 {
  cout << "Invalid login\n";
  Login();
 }
 exit(0); 
}


void stocks::Menu()
{
 MAPS.cs1();
 //system("cls"); 
 cout << "Welcome!\n";
 cout << "*---------------*---------------*\n"
   << "*[A] Product List        	*\n"
   << "*[B] Print Data                 *\n"
   << "*[C] Search Data                *\n"
   << "*[D] Exit Program               *\n"
   << "*---------------*---------------*\n";
 cout << "Choose an option: ";
 cin  >> VARS.mainOpt;
 VARS.mainOpt = putchar(toupper (VARS.mainOpt));
 if (VARS.mainOpt=='A') {
  //system("cls");
  Products();
 }
 else if (VARS.mainOpt=='B') {
  //system("cls");
  PrintReceipt(VARS.sum);
 }
 else if (VARS.mainOpt=='C') {
 // system("cls");
  SearchItem();
 }
 else  {
//  system("cls");
	openFile();
	thug.Desc.clear();
	thug.p.clear();
	thug.q1.clear();
	thug.quan.clear();
	thug.s.clear();
  exit(0);
 }
}



void stocks::Menu1()
{
 CS cs();
 //system("cls");
 //system ("Color F2");
 for (int i=0; i <STOCKS; i++) {
   if (thug.q1[i]<=thug.s[i]) {
    cout << "Must Repurchase item: Stock No. #" << i+1 << "  " << thug.Desc[i]  << endl;
   }
 }
 cout << "Welcome!\n";
 cout << "*---------------*---------------*\n"
   << "*[A] Stock List     	        *\n"	
   << "*[B] Product List		*\n"
   << "*[C] Search through stocks      *\n"
   << "*[D] Item/s Configuration	*\n"
   << "*[E] Exit Program               *\n"
   << "*---------------*---------------*\n";
 cout << "Choose an option: ";
 cin  >> VARS.mainOpt;
 VARS.mainOpt = toupper (VARS.mainOpt);
 if (VARS.mainOpt=='A') {
//  system("cls");
  Products1();
 }
 else if (VARS.mainOpt=='B') {
// 	system("cls");
 	Products();
 }
 else if (VARS.mainOpt=='C') {
//  system("cls");
  SearchItem();
 }
 else if (VARS.mainOpt=='D') {
// 	system("cls");
 	ItemConfig();
 }
 else  {
//  system("cls");
		openFile();
	thug.Desc.clear();
	thug.p.clear();
	thug.q1.clear();
	thug.quan.clear();
	thug.s.clear();
  exit(0);
 }
}


void stocks::ItemConfig() {
	cout << "*---------------*----------------*\n"
		 << "*[A] Delete Item/"<< setw(25) << "*\n"
		 << "*[B] Change Item/s"<< setw(24) << "*\n"
		 << "*[C] Change price/s"<< setw(23) << "*\n"
		 << "*[D] Add quantity for repurchased items" << setw(10) << "*\n"
		 << "*[D] Back To Menu"<< setw(25) << "*\n"
		 << "*[E] Exit Program"<< setw(25) << "*\n"
		 << "*---------------*----------------*\n";
	cin >> VARS.mainOpt;
	if (VARS.mainOpt=='A') {
// 	system("cls");
		deleteItem();
	}
	else if (VARS.mainOpt=='B') {
// 	system("cls");
		Itemchange();
	}
	else if (VARS.mainOpt=='C') {
// 	system("cls");
		priceChange();
	}
	else if (VARS.mainOpt=='D') {
//	system("cls");
		Menu1();
	}
	else{
		openFile();
	thug.Desc.clear();
	thug.p.clear();
	thug.q1.clear();
	thug.quan.clear();
	thug.s.clear();
	 exit(0);
	}
}
Last edited on
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
void stocks::priceChange() {
	int input;
	double prayz;
	char yesno;
	bool tf;
	for (int i=0;i<STOCKS;i++) {
	  cout << i+1 << "  " << thug.Desc[i] << setw(20) << thug.p[i] << endl;
	 }
	 do {
		cout << "Which item do you want to change?";
		cin >> input;
			if (input>STOCKS || input<=0) Menu1();                  //exit(0);
		cout << "Price: ";
		cin >> prayz;
		//if (prayz<=0) //exit(0);
		cout << "Do you want to change anymore items?";
		cin >> yesno;
		yesno=toupper(yesno);
		if (yesno=='Y')  tf=true;
		else  {
			cout << "Do you want to delete any items?";
			cin >> yesno;
		yesno=toupper(yesno);
			if (yesno=='Y') {
				system("cls");
				deleteItem();
			}
			else tf=false;
		}
	} while(tf==true);
	Menu1();
}

void stocks::Itemchange() {
	int input, num;
	double prayz;
	string inputs;
	char yesno;
	bool tf;
	for (int i=0;i<STOCKS;i++) {
	  cout << i+1 << "  " << thug.Desc[i] << setw(20) << thug.p[i] << endl;
	 }
	do {
		cout << "Which item do you want to change?";
		cin >> input;
			if (input>STOCKS || input<=0) exit(0);
		cout << "New Item Description: ";
		getline(cin,inputs);
		thug.Desc[input]=inputs;
		cout << "Price: ";
		cin >> prayz;
		if (prayz<=0) exit(0);
		thug.p[input]=prayz;
		cout << "Quantity: ";
		cin >> num;
		thug.quan[input]=num;
		thug.q1[input]=num;
		thug.s[input]=num*3/4;
		cout << "Do you want to change anymore items?";
		cin >> yesno;
		yesno=toupper(yesno);
		if (yesno=='Y')  tf=true;
		else  {
			cout << "Do you want to delete any items?";
			cin >> yesno;
		yesno=toupper(yesno);
			if (yesno=='Y') {
				system("cls");
				deleteItem();
			}
			else tf=false;
		}
	} while(tf==true);
	Menu1();
}




/////    ORDERING FUNCTION
void stocks::Products () {
 int quan;
 for (int i=0;i<STOCKS;i++) {
  cout << i+1 << "  " << thug.Desc[i] << setw(20) << thug.p[i] << endl;
 }
 do {
 cout << "\nOrder(Enter from 1 to " << STOCKS << " and enter 0 to exit to menu): ";
  cin >> VARS.num;
  if (VARS.num==0) Menu();
  else if (VARS.num>STOCKS) exit(0);
  
   cout << VARS.num << "  " << thug.Desc[VARS.num-1] << "   " << thug.p[VARS.num-1] << endl;
   if (thug.quan[VARS.num-1]==0) cout << "There's no more stock for this item";
   else {
     cout << "How many of these do you need?    ";
    cin >> quan;
    VARS.numOfOrder[counter]=VARS.num;
    thug.q1[VARS.numOfOrder[counter]-1]-=quan;
    VARS.quantity[counter]=quan;
    counter++;
   }
 } while(VARS.num!=0);
}

////ADD ITEM FUNCTION   ONLY ACCESSIBLE BY THE ADMIN
void stocks::Products1() {
	int quan;
	double prayz;
			 string item="\0";
			 char_ticker=0;
			 char yesno;
			 //char character, character1[10];
			 for (int i=0;i<STOCKS;i++) {
			  cout << i+1 << "  " << thug.Desc[i] << "   " << thug.p[i] << endl;
			 }
			 do {
			  cout << "Do you want to add any item?";
			  cin >> yesno;
			  yesno=toupper(yesno);
			  if (yesno=='Y') {
					   STOCKS++;
					   cout << "Please enter the Item Description: ";
					   if (cin.peek()=='\n') cin.ignore();
					   getline(cin,item);
					   thug.Desc[STOCKS]=item;
					   cout << "Please enter the price of the item: ";
					   cin >> prayz;
					   thug.p[STOCKS]=prayz;
					  /* do {
					    character=_getch();
					    if (character==13) {
					     cout << "\n";
					     break;
					    }
					    else if (character==8) {
					     cout << "\b \b";
					    }
					    else if (isdigit(character)) {
					     cout << character;
					     character1[char_ticker]=character;
					     char_ticker++;
					    }
					   } while(character!=13);
					   thug.p[STOCKS]=atof(character1); */
			   			cout << "Quantity: ";
			   			cin >> quan;
			   			thug.quan[STOCKS]=quan;
			   			thug.q1[STOCKS]=quan;
			   			thug.s[STOCKS]=quan*2/5;
			  }
			  else if (yesno=='N'){
			   break;
			  }
			 } while(yesno=='Y'||yesno=='N');
			 Menu1();
			 CS cs();
}


/////   SEARCH ITEM FUNCTION
void stocks::SearchItem() {
		 bool again, again1;
		 int item, n;
		 char tf;
		 do {
		  cout << "Please enter Stock number:\n";
			cin >> item;
		  n=search(item);
		  if (n==-1) {
		  	cout << "Item not found\n";
		  }
		
		  do {
		   cout << "Do you want to search again?";
		   cin >> tf;
		   tf=toupper(tf);
		   if (tf=='Y') {
		   	//system("cls");
		    again1=false; again=true;
		   }
		   else if (tf=='N') {
		    again1=false;
		    again=false;
		   }
		   else {
		    cout << "Please input again!\n\n";
		    again1=true;
		   }
		  } while (again1==true);
		 } while (again==true); 
		 Menu1();
}




/////   SPRINT RECEIPT FUNCTION
void stocks::PrintReceipt(double sum) {
    sum=0;
 bool tf;
     double payment, change;
     cout << "Purchased: \n"
    << "Stock No\tItem Description\t\tUnit Price\t\tQuantity";
     for (int i=0;i<counter;i++) {
         cout << endl << VARS.numOfOrder[i]<< "\t\t" << thug.Desc[VARS.numOfOrder[i]-1]
              << "\t  Php " << thug.p[VARS.numOfOrder[i]-1] << "\t\t"
     << VARS.quantity[i] << endl;
         sum+=thug.p[VARS.numOfOrder[i]-1] * VARS.quantity[i];
         }
     cout << "\nAmount due\t\t Php" << sum
          << "\nPlease pay now! Or you'll be arrested\n";
    do {
      cin >> payment;
      if (payment<sum) {
                       cout << "Your money is less than the right amount, please pay again\nPay up: ";
                      tf=false;
                       }
      else {
           change=payment-sum;
           cout << "Change: " << change << "\nThank you and goodbye";
           tf=true;
           VARS.sum+=sum;
      }
     } while (tf==false);
     system("pause>0");
     Menu();
}


void stocks::deleteItem() {
	int input;
	char yesno;
	bool tf;
	for (int i=0;i<STOCKS;i++) {
	cout << i+1 << "  " << thug.Desc[i] << "   " << thug.p[i] << endl;
	}
	do {
			cout << "Which item do you wish to delete?";
			cin >> input;
			if (input>STOCKS || input<=0) exit(0);
			for (;input<STOCKS;input++) {
				thug.Desc[input-1]=thug.Desc[input];
				thug.p[input-1]=thug.p[input];
				thug.q1[input-1]=thug.q1[input];
				thug.quan[input-1]=thug.quan[input];
				thug.s[input-1]=thug.s[input];
			}
			STOCKS--;
			cout << "Do you want to delete more items?";
			cin >> yesno;
			yesno=toupper(yesno);
			if(yesno=='Y') {
				tf=true;
			}
			else {
				tf=false;
			}
	} while(tf==true);
	cout << "Here's an updated list of the items";
	for (int i=0;i<STOCKS;i++) {
	cout << i+1 << "  " << thug.Desc[i] << "   " << thug.p[i] << endl;
	}
	Menu1();
}


void stocks::addquan() {
	bool again, again1;
	char tf;
	int quan, quan1;
	do {
		cout << "Which item did you repurchase?";
		for (int i=0;i<STOCKS;i++) {
		cout << i+1 << "  " << thug.Desc[i] << "   " << thug.p[i] << endl;
		}
		cin >> quan;
		cout << "Please input the quantity of repurchased items?";
		cin >> quan1;
		thug.quan[quan]+=quan1;
		thug.q1[quan]+=quan1;
		do {
		   cout << "Do you want to add more?";
		   cin >> tf;
		   tf=toupper(tf);
		   if (tf=='Y') {
//		   	system("cls");
		    again1=false; again=true;
		   }
		   else if (tf=='N') {
		    again1=false;
		    again=false;
		   }
		   else {
		    cout << "Please input again!\n\n";
		    again1=true;
		   }
		  } while (again1==true);
	} while(again==true);
	Menu1();
}


stocks Stocks;
int main() {
    Stocks.Login();
    cin.ignore(); cin.ignore();
    return 0;
}
I'm asking very kindly to reply as early as possible cuz i am in real need of a solution pleaseee. I'm sorry to rush you all who ever gets to read this. I've been thinking on how to get rid of this problem but there is actually more in this program, considering the add item in the function Products1() which connects to Menu1(); wherein the for loop in Menu1(); after an item is added the item isn't registered in the inventory. How can i resolve this too.
I hope you all could get an answer. Thank you very much to the solvers.
You're speaking vaguely about a problem. How to reproduce the problem?

A possible problem could be this (line 45 on the top):
1
2
3
4
5
6
7
8
9
struct vars {
	string user, user1, pass, pass1, item;
	char mainOpt;
	double sum;
	char c;
	int num, STOCKS, stock;
	int numOfOrder[2]; // Note: only place enough for two
	int quantity[10];
} VARS;


numOfOrder is used in conjunction with the global variable counter. As soon as counter exceeds 1 you have a problem: It might crash or other undefined behavior.
Topic archived. No new replies allowed.