I have to create a class with a default and alt constructor to fill an inventory array of seven elements. Only one dimentional first error is a
1>e:\invclass\invclass.cpp\invclass.cpp\invclass.cpp(83) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
here is my class code why won't this compile I don't understand?
#include <iostream>; /* input and output access*/
#include <iomanip>; /* to format line columns */
#include <fstream>; /* infile manipulation */
#include <string>; /* preprocessor for string class*/
using namespace std;
// Constants
const int NUM_SIZE = 7; /* number of elements of array */
const string FILENAME = "inventory.txt" ; /*file typedef */
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Class inventory section
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
class Inventory
{
private:
string itemName;
int quantity;
double cost;
double totalCost;
public:
Inventory (); // Default Constructor
Inventory (string, int, double); // Alternate Constructor
// Set Functions
void setItemName ();
void setQuantity ();
void setCost ();
void setTotalCost ();
// Get Functions
string getItemName; ( ) const {return itemName;};
int getQuantitiy; ( ) const {return quantity;};
double getCost; ( ) const {return cost;};
double getTotalCost ( ) {return totalCost};
// Format output
void displayItems () const;
};
//+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+
//---------------------------------------------------
//prototype inventory intro
void introHeader ()
void inventoryHeader();
int main ()
{
ifstream inFile;
string itemName;
int itemQuantity;
double itemCost;
Inventory inventory;
Inventory inventoryTv("HDTV", 3, 887.88);
Inventory inventoryPhone("Rotary Phone", -14, -1.25);
Inventory inventoryArray[NUM_SIZE];
//header function
introHeader();
//inventory header
inventoryHeader();
//individual class objects.
inventoryTv.displayItem();
cout << endl;
inventoryPhone.displayItem();
cout << endl << endl;
inFile.open(FILENAME);
if (!inFile)
{
cout << "File access failed."
<< endl << endl;
exit (EXIT_FAILURE);
}
cout << endl << endl;
inventoryHeader();
for (int i = 0; i < NUM_SIZE; i++)
{
cout << setw(15) << inventoryArray[i].getItemName();
cout << setw(15) << inventoryArray[i].getQuantity();
cout << setw(17) << inventoryArray[i].getCost();
cout << setw(17) << inventoryArray[i].getTotalCost() << endl;
}
cout << endl << endl;
inFile >> itemQuantity;
cout << " The inventory total is " << itemNUM <<" items.\n";
cout << endl << endl;
for(int item = 0; item < 5; ++item )
{
inFile << itemName;
cout << itemName << endl;
inFile >> itemQuantity;
cout << itemQuantity << endl;
inFile >> itemCost;
cout << itemCost;
inFile.ignore(80, '\n');
}
inFile.clear();
inFile.close();
// function call for the closing statement
//closeInventory();
cout << endl;
return (0);
}