Here are my error messages:
! "printStock(int, int)", referenced from:
_main in main.o
_main in main.o
! "Sales(int, int, double)", referenced from:
_main in main.o
Symbol(s) not found
Here is my code:
#include <iostream>
#include <cmath>
#include <iomanip>
#include <fstream>
using namespace std;
void printStock(int,int);
double Sales(int,int,double);
int main ()
{
ifstream transInfo;
transInfo.open("transinfo.txt");
if(!transInfo.is_open()) {
cout << "File was not opened correctly" << endl;
cout << "program halted";
return 0;
}
int transtype, autonumb, units, i;
int inv[10]={0,0,0,0,0,0,0,0,0,0};
for (i=0; i<10; i++)
inv[i]=i;
printStock(inv[10],10);
transInfo >> transtype >> autonumb >> units;
for (i=0; i<10; i++){
if (transtype==1) {
if (inv[autonumb]>=units) {
inv[autonumb]-=units;
cout << "Sell " << units << " units of car " << autonumb << endl;
}
else cout << "REJECTED: Insufficient Stock" << endl;
}
else if (transtype==2) {
inv[autonumb]+=units;
cout << "Receive " << units << " units of car " << autonumb << endl;
}
else cout << "INVALID TRANSACTION CODE" << transtype << endl;
transInfo >> transtype >> autonumb >> units;
}
cout << endl;
printStock(inv[i],10);
cout << "\n\nTotal potential income: " << Sales(inv[i],10,10000) << endl;
transInfo.close();
return 0;
}
void printStock (int v[], int n) {
for (int i=0; i<n; i++)
cout << i << v[i];
return;
}
double Sales (int v[], int n, double cost) {
int autos=0;
for (int i=0; i<n; i++)
autos+=i;
int val=autos*cost;
return val;
}
I don't know what's wrong so I don't know exactly what to ask. I need some diagnostic help in the first place. So I need all kinds of help, any I can get. Thank you.