c++ multi-character constant error?
Hi! I'm new to the board and am nearing the end of my first c++ class. I have the following code:
void GetQuantity(string descr, int& qty) { int amount; cout << "How many " << descr << " would you like to purchase?" << endl; cin >> amount; while ((qty+amount < 0)||(!cin)) { cin.clear(); cin.ignore(256, '/n'); cout << "************************************************" << endl; cout << "I'm sorry, the quantity you entered is not valid" << endl; cout << "************************************************" << endl << end cout << "You have chosen " << qty << " " << descr << "so far," << end cout << "How many more would you like to purchase?" << endl; cin >> amount; } qty = qty + amount; } I get the following error when I compile: p7.cpp:373:23: warning: multi-character character constant Line 373 is the cin.ignore(256, '/n'); What am I doing wrong there? Thanks to anyone who can help.... azucarmom |
Try '\n' instead of '/n' ...
Cheers, Tink |
Use '\n' instead of '/n'. '/n' is interpreted as two characters, '/' and 'n'.
|
I was slower... :)
|
Thanks everyone!! That was exactly the problem. <sigh> For some reason I thought I had already done that and it hadn't worked. Brain freeze...
|
All times are GMT -5. The time now is 01:46 AM. |