Hi folks...hope you guys can help me and fast....i'm working on a project for school. i'm using the Dev C++ complier...i'm at my wits ends on this project. i've attached it below along with the errors i keep getting and can't figure out. PLEASE SOMEONE HELP...MY PROJECT IS DUE BY 11:59 PM EASTER STANDARD TIME. i really apprectiate it. thnx.
Here are the errors i'm getting while compiling in Dev C++:Code:#include <iostream.h> #include <fstream> #include <stdlib.h> #include <string> #include <ctime> #include <iomanip> const int max = 50; //class for the input file class product { public: product();//constructor //copy constructor product(const product&); //string get();//for print function to access the members //float get(); //char get(); void get(float&, char&, string&); void set(int, string, float, char); friend bool operator==(product, product); //overloading operator == int product::get(int, product); private: int product_num; string name; float price; char tax; }; class sList { public: void MakeEmpty (); bool IsFull (); bool IsEmpty (); int LengthIs (); bool IsThere (int, int& location) const; void Insert (product); void Delete (); void ResetList (); product get (int&); private: int length; product info[max]; int currentPos; friend void BinSearch(/*in*/ int, /*out*/ bool&, /*out*/ int&); }; int main() { //declarations ifstream in; ofstream out; int times, pnum;//times is the quantity and pnum holds product id from input file int item; //holds product id from keyboard float pr;// holds price from input file string n;//holds name from input file bool found; int place;//holds index for where the product is char ta; //holds tax from input file sList list; //declares variable of class slist product inventory;//declares variable of class product time_t rawtime; float subtotal = 0;//holds subtotal float totTax = 0;//holds total tax value //initializing list list.MakeEmpty(); //opening file in.open("Invent.in"); while(!in) { cout << "Inventory file did not open. Please try again."; return 1; } //opening output file out.open("Receipts.out"); //priming reading in >> pnum >> n >> pr >> ta; while(!in.eof()) { inventory.set (pnum, n, pr, ta); list.Insert(inventory); in >> pnum >> n >> pr >> ta; } int cus_no = 0; do { cus_no++; cout << "Please start processing the order in the form of productNumber"; cout << "and the number of times for each product and enter 0 at the end of the"; cout << "order." << endl; cin >> item >> times; //check for improper times value while((times > 100) || (times <= 0)) cout << "Error, times is out of range. Please enter a number between 1 and 100"; do{ if(item !=0) { product temp; //holds temp value for product class BinSearch(item, found, place); if(found == true) { temp = list.get(place);//places the whole product into temp //float tprice = temp.getprice(); //char t_tax = temp.get(tax); //string tname = temp.get(name); float price; char tax; string name; temp.get(price, tax, name); time(&rawtime);//gets time in seconds out << ctime(&rawtime)<<endl; //converts seconds into a string if(tax == 'T') { float tvalue = 0;//holds value for tax tvalue = price * .075; float actualPrice = 0; // price after tax is added actualPrice = price + tvalue; totTax +=tvalue; out<< "Customer "<<cus_no<<endl; out << name << " " <<times<<" @ "<< price; out << (price * times) <<tax<<"X" <<endl; } else { out<< "Customer "<<cus_no<<endl; out << name << " " <<times<<" @ "<< price; out << (price * times) <<endl; } } else out <<"********"<<setw(5)<<setfill('o')<<item<<" not in inventory****"<<setfill(' '); char repeat; cout << "Is there another item to process? Enter the product id or 0 for the end of the order."; cin >>item; }while(item); } else { out << "Subtotal "<<" " <<subtotal<<endl; out <<"Tax"<<" "<<totTax<<endl; float total = 0; total = subtotal + totTax; out << "Total" <<" "<<total<<endl; } } char response; cout <<"Is there another cusotmer to be processed? Enter Y for yes and N for no"<<endl; cin >>response; if(response == 'N') cout << "Have a nice day!"<<endl; }while(response == 'Y'); } return 0; } //******************************************************** void sList::Insert(product inventory) { int index, product_num; if(length < max && !IsThere(product_num, index)) { info[length] = inventory ; length++ ; } else cout<<endl<<"List is full or contains the product number-operation aborted"; } //*************************************************************** sList::sList ( ) { length = 0; currentPos = 0; } //*************************************************************** void sList::MakeEmpty ( ) { length = 0 ; currentPos = 0; } //****************************************************************** int sList::LengthIs ( ) { return length ; } //***************************************************** bool sList::IsFull ( ) { return ( length == max ) ; } //****************************************************************** bool sList::IsThere (int pro_id, int& location ) const { bool found; //binary search is called BinSearch(pro_id, found, location); return found; } //******************************************************************** /*void sList::Delete ( ) { int location; if(IsThere(product_num, location)) { // move last element into position where item was located info [location] = info [length - 1 ] ; length-- ; } } */ //************************************************************************** bool sList::IsEmpty() { return (length == 0); } //**************************************************************************** void sList::ResetList ( ) { currentPos = 0; } //**************************************************************************** product sList::get (int& location) { product temp; temp=info[location]; return temp; } //**************************************************************** product::product(const product& copyInven) { product inventory; product_num = inventory.product_num; name = inventory.name; price = inventory.price; tax = inventory.tax; } //********************************************************************** void product::set (int pid, string nam, float cost, char t) { product_num = pid; name = nam; price = cost; tax = t; } //********************************************************************** bool operator==(product anotherItem, product inventory) { if(inventory.product_num == anotherItem.product_num) return true; else return false; } //*************************************************************** /*bool operator<(product anotherItem) { if(inventory.product_num < anotherItem.product_num) return true; else return false; } */ //**************************************************************** /*bool operator>(product anotherItem, product inventory) { if (inventory.product_num > anotherItem.product_num) return true; else return false; } */ //***************************************************************** void sList::BinSearch(/*in*/ int pro_id, /*out*/ bool& found, /*out*/ int& position) { int first = 0; //lower bound int last = length -1; //upper bound int mid; //middle index sList list; found = true; product temp; //declares an object of class product for get functions int t_pid, product_num;//holds temp value for product id for comparing purposes while(last >= first && !found) { mid = (first + last) / 2; temp = list.get(position); t_pid =temp.get(product_num, temp); if (t_pid < pro_id) last = mid - 1; else if(t_pid > pro_id) first = mid + 1; else //Assert: t_pid == pro_id found = false; } if (!found) position = mid; } //*************************************************************************** /*string product::get()*/ /*{ string n; n = temp.name; return n; } //************************************************************************** float product::get() { float p; p = temp.price; return p; } //************************************************************************** char product::get() { char t; t=temp.tax; return t; }*/ //******************************* void product::get(float& price, char& tax, string& name) { product temp; price = temp.price; tax = temp.tax; name = temp.name; } //************************************************************* int product::get(int product_num, product temp) { int t_pid; t_pid =temp.product_num; return t_pid; }
154 parse error before `else'
162 parse error before `}'
164 syntax error before `<'
165 syntax error before `>'
189 definition of implicitly-declared `sList::sList()'
189 redefinition of `sList::sList()'
50 `sList::sList()' previously defined here
296 no `void sList::BinSearch(int, bool &, int &)' member function declared in class `sList'
SOMEBODY PLEASE HELP!!!



LinkBack URL
About LinkBacks


