User Profile
Collapse
-
Wow! Forgive me for being so uneducated, but that went way over my head. I think I get the big picture though. I've changed everything to ints and it seems to be working properly. Thank you for your help. -
"amount" is a double. When the user enters an amount, they can enter 5.23. Then what I'm trying to do is take that 5.23 and multiply by 100 so I can work with the modulus operator. Can you show me a better way? Thank you!...Leave a comment:
-
Multiplying money by 100 - loss of pennies
Hello! I am having issues with my code. My program is supposed to take a given amount of money (1.33) and tell how many quarters, dimes, nickels and pennies would make up this sum of money. Problem is when I multiply the input by 100, depending on the amount of money entered, I lose a penny. When I enter .34 it comes out correct, but when I enter .35, it gives me 34. Any and all help is greatly appreciated. Here is part of my code:
... -
Well, it took a week, but I figured it out on my own. Thanks anyway.Leave a comment:
-
I guess I had better mention that I am in a C++ class and we haven't learned how to use set containers yet. My vector will hold no more than 15 items so is there a way to do it using vectors?
Thank you for your help.lLeave a comment:
-
How do you use a set container? I'm very new to C++ Programming. Thank you for your help.Leave a comment:
-
Taking out duplicate items in a vector
Code:int total = static_cast<int>(vComp.size()) - 1; int tTotalUnits = 0; float tTotalCostJob = 0; int i = 0; int j = 0; int counter = 0; bool foundFlag; vector<string> vItems; vector<string> vHolding; for(i = 0; i < total; ++i) { // Push components into the vItems vector vHolding.push_back(vComp[i].GetType());
-
That's it! That's exactly it! Thank you, thank you, THANK YOU!!!! I was making it much harder than it had to be. Thank you so much for all your help.Leave a comment:
-
-
That's exactly what I need the program to do. Here is the original Irrigation Estimator class. I just don't understand how to push items into the vComp vector:
Code:class IrrigationEstimator { private: vector<IrrigationComponent> vComp; string companyName, busName; public: IrrigationEstimator(); bool ReadData(); string WriteInvoice(); };
Leave a comment:
-
Sorry about the code tags. Hope I did it right this time. Here is the IrrigationCompo nent class. Thank you so much for any and all help.
Code:#include <string> using namespace std; class IrrigationComponent { private: string type, name; int required; float gallons, gph, cost, totalCost; void CalcCost(); void CalcGPH(); public:
Leave a comment:
-
vector of vectors
Hello:
This is my first time here so I hope I am doing this correctly. I am trying to push a vector object into a vector (I think). Here is my code (header file first) but it's only part of the code. Hope this is enough to make sense. I am getting the error:
Code:IrrigationEstimator.cpp c:\documents and settings\developer\desktop\c++ ii\jacksonp5\jacksonp5\irrigationestimator.cpp(53) : error C2664: 'std::vector<_Ty>::push_back'
No activity results to display
Show More
Leave a comment: