Help adding a Class in C++ need help!!!

Pages: 12
Please assist!!

I am having issues displaying the greeting message after you enter the name and address it should say:


Hello: custName, Address: custAdress


This will not display after you enter name and address it goes right to the displayMenu.

Class code where the greeting resides:
lines 9-36
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
class Customer
{
	std::string custName; // Customer name
	std::string custAddress; //Customer Address

public:
	void info()
	{
		cout << setw(10) << left << "Name" << custName << "\n"
			<< setw(10) << left << "Address" << custAddress << "\n" << endl;
	}

	void simpleInfo()
	{
		cout << "Hello: " << custName << " , Address: " << custAddress << endl;
	}
	std::string value() const
	{
		return custName;
	}

	Customer() {}
	~Customer() {}
	Customer(string n, string a) {
		custName = n;
		custAddress = a;
	}
}; // END OF CLASS 


Code where class is called lines:
195-196
1
2
Customer patron = snafu(); // get info, create patron
	patron.simpleInfo(); // greet patron  


Can you please assist me with this issue? Am I doing something incorrectly please advise.
Last edited on
seems to be working https://repl.it/repls/DismalHonoredSoftwareagent

You just have a small formatting error in the total price. If i order 10 sodas at $2.98, it shows $29.8 instead of $29.80 . Would be cool if the program gave a running total of what was purchased so far, in addition to the final total.

I took out the system commands like system("cls") cause it's not supported on linux (many online interpreters like the one I linked are based on linux), and system("pause") cause it has no place in a method other than main(), and also it's not good practice -- if you're debugging , set a breakpoint at the last closing bracket of main() so that the console doesn't go away. If you're in 'release' mode, then you should be running the program from a console and not from within an IDE like visual studio, so there's no need to try to save console from disappearing.

Last edited on
Topic archived. No new replies allowed.
Pages: 12