Well I have this string in my class and i try to type two words or more and it will mess up and input those values into my other cin statements. I'm sure there must be away to allow whitespaces but I have yet to discover it from searching on the net. I removed all the other methods to make it a lot easier to find.
Also, is there any way to limit strings? I have looked on the net about it but from what I can tell strings predefine their length and I have seen no ways to change that.
Any help you guys can give would be great.Code:#include <iostream> #include <string> #include <iomanip> using namespace std; class cPRODUCT { private: long nSerialNum; string ProductDesc; float fWholesale; float fRetailcost; int nInStock; float fTotalValue; public: cPRODUCT(void) { nSerialNum = 0; ProductDesc = ""; fWholesale = 0; fRetailcost = 0; nInStock = 0; fTotalValue = 0; } void enterProdInfo(void) { cout << "Please enter the product description (max 18 characters): "; cin >> ProductDesc; } };
Thanks,
...Dan
Hopefully this isn't a really obvious answer like my previous two lol.



LinkBack URL
About LinkBacks
. 


