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);
}

Edited 6 Years Ago by pistol-pete: n/a

> #include <iostream>;
Includes are not statements - remove the trailing ;

Also, which is the real line 83?
This code looks edited compared to what you compiled.

> cout << " The inventory total is " << itemNUM <<" items.\n";
itemNum isn't declared anywhere.
But that's on line 128.

You have problems with semicolons.
Lines 48-50: remove semicolon between function name and round brackets. You can also delete semicolon at the end of each of these lines.
Line 51: missing semicolon after return totalCost line 69: missing semicolon at the end of the line

This article has been dead for over six months. Start a new discussion instead.