here's my code:
Bookstore.h
#ifndef BOOKSTORE_H
#define BOOKSTORE_H
#include <string>
#include <iostream>
using namespace std;
class Bookstore
{
private:
int iPrice;
int iPurchNum;
int iTotal;
public:
Bookstore( void );
~Bookstore();
void SetPurchaseNum( int iPurchNum );
int GetPurchaseNum( );
void SetPrice( int iPrice );
int GetPrice( );
};
#endif;
FictionBook.h
#ifndef FICTIONBOOK_H
#define FICTIONBOOK_H
#include <string>
using namespace std;
#include "Bookstore.h"
class FictionBook:public Bookstore
{
private:
public:
void SetBookName( string & n );
string GetBookName();
};
#endif;
NonFictionBook.h
#ifndef NONFICTIONBOOK_H
#define NONFICTIONBOOK_H
#include <string>
using namespace std;
#include "Bookstore.h"
class NonFictionBook:public Bookstore
{
private:
public:
void SetBookName( string & n );
string GetBookName();
};
#endif;
magazine.h
#ifndef MAGAZINE_H
#define MAGAZINE_H
#include <string>
using namespace std;
#include "Bookstore.h"
class Magazine:public Bookstore
{
private:
public:
void SetMagazineName( string & n );
string GetmagazineName();
};
#endif;
includes.h
#ifndef INCLUDES_H #define INCLUDES_H #include <iostream> #include <string> using namespace std; #include "Bookstore.h" #include "FictionBook.h" #include "Magazine.h" #include "NonFictionBook.h" #endif;
source files...
Main.cpp
#include "Includes.h"
void main ( void );
void main()
{
string sName;
int iChoice;
cout << "Please enter your name: \n";
cin >> sName;
cout << endl << "Hello, " << sName << ", and welcome to Land'o'Books!\n\n";
cout << "What would you like to purchase today?\n\n";
cout << "\t 1. Fiction Book\n \t 2. NonFiction Book\n \t 3. Magazine\n\n";
cin >> iChoice;
switch ( iChoice )
case 1:
FictionBook *oFictionBook = new FictionBook;
FictionBook->SetBookName(int);
FictionBook->GetBookName();
Bookstore->SetPurchNum(int);
Bookstore->GetPurchNum();
Bookstore->SetPrice(int);
Bookstore->GetPrice();
break;
}
Bookstore.cpp
#include "Includes.h"
Bookstore::Bookstore()
{
cout << "Constructor firing off...\n";
}
and all I have in the other source files (FictionBook.cpp, NonFictionBook.cpp, Magazine.cpp) is the #include "Includes.h"
so here are my errors ( there are 13 of them ) and they're all the same thing...I can't seem to figure out what the problem is, and I know it's going to be something stupid..
Quote
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(27) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(27) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(28) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(28) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(30) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(30) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(31) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(31) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(33) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(33) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(34) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(34) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(35) : error C2043: illegal break
Error executing cl.exe.
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(27) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(28) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(28) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(30) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(30) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(31) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(31) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(33) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(33) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(34) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(34) : error C2143: syntax error : missing ';' before '->'
C:\Documents and Settings\Administrator\Desktop\Schuth Tyler Final\Main.cpp(35) : error C2043: illegal break
Error executing cl.exe.
I'm not sure what I'm doing wrong, and when I go to correct it I get more errors. If I take my switch statement out I have no errors.
EDIT: I changed one line of code and fixed most of the errors. the line of code I changed is:
FictionBook *oFictionBook = new FictionBook
I put the * in front of the oFictionBook and it got rid of that problem. Now it tells me that I need to have a semicolon before my arrow ( -> ) operator when I'm declaring my functions and I'm not understanding that...

New Topic/Question
Reply




MultiQuote








|