I have some errors here that I do not know how to fix
prbly somthing simple too
Code:
// prblm 3 pg 538 C++ Primer Plu
// usestok2.cpp -o use the Stock class
#include <iostream>
using namespace std;
#include "stockh.hpp"
const int STKS = 4;
int main()
{
// create an array of initialized objects
Stock stocks [STKS] =
{
Stock ("NanoSmart", 12, 20.0),
Stock("Boffo Objects", 200, 2.0),
Stock("Monolithic Obelisks", 130, 3.25),
Stock("Fleep Enterprises", 60, 6.5)
};
cout.precision(2); // #.##
//errors here
cout.setf(ios_base::fixed, ios_base::floatfield);// #.## format
cout.setf(ios_base::showpoint); // #.## format
cout << "Stock holdings :\n";
int st;
for (st=0; st < STKS; st++)
cout << stocks[st];
Stock top = stocks[0];
for (st=1; st < STKS; st++)
top = top.topval(stocks[st]);
cout << "\nMost valuable holding:\n";
cout << top;
return 0;
}
here is the complier output
Building Makefile: "C:\Dev-C++\Makefile.win"
Executing make...
make.exe all -f "C:\Dev-C++\Makefile.win"
Execution terminated
g++.exe -c stockm.cpp -o stockm.o -I"C:\Dev-C++\include" -I"C:\Dev-C++\include\g++-3" -I"C:\Dev-C++\include" -s
stockm.cpp: In function `int main()':
stockm.cpp:21: `ios_base' undeclared (first use this function)
stockm.cpp:21: (Each undeclared identifier is reported only once
stockm.cpp:21: for each function it appears in.)
stockm.cpp:21: parse error before `::'
stockm.cpp:22: parse error before `::'
make.exe: *** [stockm.o] Error 1
0
please help!