I keep receiving the following compiling error when trying to print a data structure from within an array:
could not convert 'new_vehicle[t].vehicles_in::inVin' to 'bool'
If anyone can offer any insight about this error, I'd really appreciate it!![]()
Here is the code that defines the data structure within the array:
This is the code where I am calling the function to print the data structure:Code:#include <iostream> #include <cstring> #include <cctype> #include <cstdlib> #include <string> #include "Vehicle.cpp" #include "maxarray.h" using std::cout; using std::cin; using std::endl; using namespace std; const int IN_VEHICLE = 100; struct vehicles_in{ string inVin; int inPassengerCount; string inLuxury; int inMpg; char inType; }new_vehicle [IN_VEHICLE];
And here is the code for the function that is printing the data within the array.Code:void listVehicles() { int in; for (in=0; in<IN_VEHICLE; in++) printVehicle(); }
Code:void printVehicle() { int t; for (t=0;t<IN_VEHICLE;t++) { if (new_vehicle[t].inVin) { cout << new_vehicle[t].inVin; cout << new_vehicle[t].inPassengerCount; cout << new_vehicle[t].inLuxury; cout << new_vehicle[t].inMpg; cout << new_vehicle[t].inType; }



LinkBack URL
About LinkBacks




CornedBee