Hey there, so I'm a beginning program student and we have this assignment to build a program for a fish store. It's on the inventory. We cannot use classes. Anyway, I've been getting lots of the same errors in X-code and I cannot for the life of me figure out what they mean or how to fix them. Can someone please help me? The errors I'm getting are: Parse Issue: Expected "(" for function-style cast or type construction, and Semantic Issue: Redefinition of 'addFish', 'removeFish', 'searchFish','writeFishFile' and 'fishFile' as different kind of symbol. Here's my "functions.h" and my main function:
[code]
// functions.h
// Programming assignment#2
//
// Created by Isabella Perry on 10/17/14.
// Copyright (c) 2014 Isabella Perry. All rights reserved.
//
int writeFishFile(myInventory, MAX_SIZE, int currentsize)
{
ofstream fishyfile("fish");
for (int a = 0; a < currentsize; a++)
{
fishyfile << myInventory[a].name << ';'
<< myInventory[a].tank << ';'
<< myInventory[a].quantity <<';'
<< myInventory[a].price;
if ( a < currentsize-1) fishyfile << endl;
}
fishyfile.close();
}
int addFish(myInventory, MAX_SIZE, int currentsize)
{
cout << "Please enter the name of the fish" << endl;
cin >> myInventory[currentsize].name;
cout << "Please enter the tank/location" << endl;
cin >> myInventory[currentsize].tank;
cout << "Please enter the quantity" << endl;
cin >> myInventory[currentsize].quantity;
cout << "Please enter the price" << endl;
cin >> myInventory[currentsize].price;
int removeFish( myInventory, MAX_SIZE, int currentsize)
{
string deleteFish;
cout << "Please enter the name of the fish you would like to remove from inventory:" << endl;
cin >> deleteFish;
if ( currentsize < deleteFish-1)
{
myInventory[currentsize] = myInventory[deleteFish-1];
}
--deleteFish;
cout << "Your item has been deleted" << endl;
}
}
bool searchFish( myInventory, MAX_SIZE, int currentsize)
{
string fish;
cout << "Please enter the name of the fish you would like to search for: " << endl;
cin >> fish;
for (int i = 0; i < currentsize;++i)
{
if (fish == myInventory[i])
return true;
else
cout << "I'm sorry, the item you entered cannot be found in your inventory" << endl;
}
}
int updatenum( myInventory, MAX_SIZE, int currentsize)
{
int choice;
int newtotal;
int upbyone;
int downbyone;
void newtotal(int);
string fish;
cout << "Please enter the name of the fish you would like to search for: " << endl;
cin >> fish;
for (int i = 0; i < currentsize;++i)
{
if (fish == myInventory[i])
{ return true;
cout << myInventory[i].name;
cout << myInventory[i].tank;
cout << myInventory[i].quantity;
cout << myInventory[i].price << endl;
cout << "What would you like me to do?"
cout << " 1. New total quantity" << endl;
cout << " 2. Decrease by one" << endl;
cout << " 3. Increase by one" << endl;
cin >> choice;
switch (choice)
{
case 1: newtotal(newvalue);
case 2: downbyone = fish--;
case 3: upbyone = fish++;
}
void newtotal( int newvalue)
{
int num;
cout << "Please enter the new total quantity" << endl;
cin >> num;
newvalue = myInventory[i].quantity + num;
}
}
else
cout << "I'm sorry, the item you entered cannot be found in your inventory" << endl;
}
}
int updateTank( myInventory, MAX_SIZE, int currentsize)
{
int num;
displayInventory(myInventory,MAX_SIZE, currentsize);
cout << "Which fish information would you like to change?" << endl;
cin >> myInventory.name;
cout << "What tank would you like to change to?" << endl;
cin >> num;
myInventory.tank = num;
cout << "New tank: " << num << endl;
}
void exitOut()
{
return 0;
}
#endif
//This program is a catalog for a fish store.
//Isabella Perry (PERRYI)
struct Fish
{
string name;
int tank;
int quantity;
double price;
};
const int MAX_SIZE = 100;
Fish myInventory[MAX_SIZE];
void displayMenu(); //displays menu
void displayInventory();// displays inventory
int fishFile(myInventory, MAX_SIZE,int); // Reads fish inventory from a file
int writeFishFile(myInventory, MAX_SIZE, int); // Writes fish inventory to a file
int addFish(myInventory, MAX_SIZE, int); // Adds fish inventory to a file
int removeFish(myInventory,MAX_SIZE,int);// Removes Fish from Inventory
bool searchFish(myInventory,MAX_SIZE,int); // Searches fish inventory
int updatenum(myInventory, MAX_SIZE, int); // Updates fish Inventory
int updateTank(myInventory, MAX_SIZE, int); // Updates tank
void exitOut(); // Exit outs of program
Your problem is that you are not clear of how to create a function. You can't create a function like what you did. You have to create functions like this in C/C++: