Recent content by EvanET
-
E
C/C++ How to Write a Copy Assignment Operator for CarCounter in C++?
I am given a prompt to: Write a copy assignment operator for CarCounter that assigns objToCopy.carCount to the new objects's carCount, then returns *this. #include <iostream> using namespace std; class CarCounter { public: CarCounter(); CarCounter& operator=(const CarCounter&...- EvanET
- Thread
- Writing
- Replies: 1
- Forum: Programming and Computer Science
-
E
C/C++ [C++] Unit testing of a class HELP
I am using zybooks- EvanET
- Post #5
- Forum: Programming and Computer Science
-
E
C/C++ [C++] Unit testing of a class HELP
if i use the code it doesn't work, i took out the assert, the code ran but here are my results: [PASS]Inventory is 0, shipment is 25. Testing that quantityRemaining was updated to 25. Your value: 25 [PASS]Testing with sweaterShipment of 25. addInventory updates quantityRemaining. Your output...- EvanET
- Post #3
- Forum: Programming and Computer Science
-
E
C/C++ [C++] Unit testing of a class HELP
I'm given the code: #include <iostream> using namespace std; class InventoryTag { public: InventoryTag(); int getQuantityRemaining() const; void addInventory(int numItems); private: int quantityRemaining; }; InventoryTag::InventoryTag() { quantityRemaining = 0; } int...- EvanET
- Thread
- Class Testing Unit
- Replies: 4
- Forum: Programming and Computer Science
-
E
C/C++ Need help coding with assigning the size of a Vector (C++)
WOW(Headbang) i just had it backwards this whole time (Giggle) i previously tried it as: sensorReadings.size() = currentSize; i guess i just need to read it right to left, so to speak.- EvanET
- Post #7
- Forum: Programming and Computer Science
-
E
C/C++ Need help coding with assigning the size of a Vector (C++)
Hmmm.. ok. sensorReadings.size() = currentSize; so like that?- EvanET
- Post #5
- Forum: Programming and Computer Science
-
E
C/C++ Need help coding with assigning the size of a Vector (C++)
are you meaning like -> .resize?- EvanET
- Post #3
- Forum: Programming and Computer Science
-
E
C/C++ Find Min/Max Miles in milesTracker Program
on your second for statement make this correction: for(j=0;j<NUM_COLS;++j) this is what it said before: for(j=0;i<NUM_COLS;++j) all i changed was the i and made it j, this completed the code and ran everything.- EvanET
- Post #13
- Forum: Programming and Computer Science
-
E
C/C++ Need help coding with assigning the size of a Vector (C++)
I am prompted to: Assign the size of vector sensorReadings to currentSize. Assigning is the double equal sign (==) but i get an extremely long error i am given this much code: #include <iostream> #include <vector> using namespace std; int main() { vector<int> sensorReadings(4); int...- EvanET
- Thread
- Coding Vector
- Replies: 6
- Forum: Programming and Computer Science
-
E
C/C++ How to Properly Resize and Populate a Vector in C++ Without Using push_back?
Resize vector countDown to have newSize elements. Populate the vector with integers {newSize, newSize - 1, ..., 1}. Ex: If newSize = 3, then countDown = {3, 2, 1}, and the sample program outputs: 3 2 1 Go! **I want to do this WITHOUT push_back** #include <iostream> #include <vector> using...- EvanET
- Thread
- C++ Vector
- Replies: 1
- Forum: Programming and Computer Science