How to fix some of these problems?

Hi, so in my code, whenever I try to input something, it keeps looping for some reason, and I don't know how to fix it. Is there some things that I should eliminate because I feel like I am adding random things that do not help?
This is what it is suppose to do:
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
                 Welcome to Fred's Gas'n'Go Car Wash System!!!

Would you like a car wash today?  you becha!

Which wash would you like:  Super, Premium, or Ultra?  super...man

That will be $5.00, is that okay?  no way!  es muy dinero!

I'm sorry...


Would you like a car wash today?  YES!!!

Which wash would you like:  Super, Premium, or Ultra?  Ultra...man

That will be $8.00, is that okay?  No can do, kemo slabe...

I'm sorry...


Would you like a car wash today?  yuh...but I'm losing hope...

Which wash would you like:  Super, Premium, or Ultra?  premioso por favor

That will be $6.00, is that okay?  yeah...let me take out a loan first...


Good, your wash code is 5783210.  It will be good until noon on Friday.


Thank you for using the FGnGCWS!!

Endeavor to have a spot-free day!

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
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>

using namespace std;

char carwashdecision(){
  char decision;
  
  cout << "Would you like a car wash today? ";
  cin >> decision;
  cin.ignore(INT_MAX, '\n');
  
  if(decision == 'y' || decision == 'Y'){
  return decision;
  }
  
  else if(decision == 'n' || decision == 'N'){
  cout << "\nThank you for using the FGnGCWS!!";
  return 0;
  }
  
  else{
  cout << "\nThank you for using the FGnGCWS!!";
  return 0;
  }
}

char washdecision(){
char washdecision;
char pricedecision1;

cout << "\nWhich wash would you like: Super, Premium, or Ultra? ";
cin >> washdecision;
cin.ignore(INT_MAX, '\n');

if(washdecision == 's' || washdecision == 'S'){
cout << "\nThat will be $5.00, is that okay? ";
cin >> pricedecision1;
cin.ignore(INT_MAX, '\n');
return pricedecision1;
}

if(washdecision == 'p' || washdecision == 'P'){
cout << "\nThat will be $6.00, is that okay? ";
cin >> pricedecision1;
cin.ignore(INT_MAX, '\n');
return pricedecision1;

}

if(washdecision == 'u' || washdecision == 'U'){
cout << "\nThat will be $8.00, is that okay? ";
cin >> pricedecision1;
cin.ignore(INT_MAX, '\n');
return pricedecision1;
}
}

char pricedecision(){

	char pricedecision;
	
	if(pricedecision == 'y' || pricedecision == 'Y'){
	cout << "\nGood, your wash code is 5783210. It will be good until noon on Friday.\n\n";
	cout << "\nThank you for using the FGnGCWS!!\n";
	cout << "\nEndeavor to have a spot-free day!\n\n";
}

	if(pricedecision == 'n' || pricedecision == 'N'){
	cout << "I'm sorry...";
	}
}	 
int main(void){
bool loop = true;
  
  cout << "Welcome to Fred's Gas'n'Go Car Wash System!!!\n\n";
	  
	while(loop){
	if(carwashdecision() == 'Y' || carwashdecision() == 'y')
	{
	washdecision();
	}
	
	if(washdecision() == 's' || washdecision() == 'S'){
	pricedecision();
	
	if(pricedecision() == 'Y' || pricedecision() == 'y'){
	pricedecision();
	}
	
	else{
	pricedecision();
	}
	}
	
	if(washdecision() == 'p' || washdecision() == 'P'){
	pricedecision();
	}
	
	if(washdecision() == 'u' || washdecision() == 'U'){
	pricedecision();
	}
	
	else
	{
	    loop = false;
	}
	}
}
You're calling your washdecision() and carwashdecision() multiple times so you will need to enter data multiple times.
Topic archived. No new replies allowed.