![]() |
print method
Alright, i have a program that allows users to add an employee, display employees, add a car, and display cars. These are broken into classes a car class and an employee class. The functionality of employee works fine. However, in car class when i display the cars to the screen the last line is a zero. It is this way if you add 1 car or 4 cars. I can not figure out why because i use the same method to display the cars as i do employees. Heres the code:
:
#include <iostream> |
I have only glanced at your code. This is usually wrong:
Quote:
|
Don't have much time right now, but you should include <string>.
<string.h> can be replaced by <cstring>, I'm not sure you even need it (didn't look that far). |
yea i changed the for loop to for(int i = 0; i < loc; i++) but now my question is why did: for(int i = 0; i <=loc; i++) work for displaying employees and not for cars? Isnt it pretty much the same thing?
|
Sometimes a bug doesn't bite -- until you least expect it. If you printed one too many employees, it might have just had no effect. Could have been a totally 'empty' piece of information that terminated the process. One can't rely on that; when the customer's present, it'll always make your machine run off into the weeds and upchuck. Murphy's law.
|
| All times are GMT -5. The time now is 4:37 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC