I get 27 errors when I try to compile, none of which make sense to me, since the code looks good. I have my header file included, and all of my function definitions are in the class contained in the header. You can see an assignment sheet here .
I am not looking for someone to do it for me, but rather someone to point out the error causing code...This program is supposed to do what is described in the sheet linked above. And now for the code...
Logbook.cpp (The only source I am supposed to edit):
logbook.h: - //--------------------------------------------------------------------
-
//
-
// Laboratory 1 logbook.h
-
//
-
// Class declaration for the Logbook ADT
-
//
-
//--------------------------------------------------------------------
-
-
class Logbook
-
{
-
public:
-
-
// Constructor
-
Logbook ( int month, int year ); // Create a logbook
-
-
// Logbook marking operations
-
void putEntry ( int day, int value ); // Store entry for day
-
int getEntry ( int day ) const; // Return entry for day
-
-
// General operations
-
int month () const; // Return the month
-
int year () const; // Return the year
-
int daysInMonth () const; // Number of days in month
-
-
// In-lab operations
-
void displayCalendar () const; // Display as calendar
-
Logbook (); // Default constructor
-
void putEntry ( int value ); // Store entry for today
-
int operator [] ( int day ) const; // Return entry for day
-
void operator += ( const Logbook &rightLogbook );
-
// Combine logbooks
-
private:
-
-
// Facilitator (helper) function
-
int leapYear () const; // Leap year?
-
-
// In-lab facilitator function
-
int dayOfWeek ( int day ) const; // Return day of the week
-
-
// Data members
-
int logMonth, // Month covered by logbook
-
logYear,
-
entry [32]; // Logbook entries
-
};
8 3331
the errors (I fixed the switch error...but the others I still get): - ------ Build started: Project: lab1, Configuration: Debug Win32 ------
-
Compiling...
-
Logbook.cpp
-
f:\c projects\112\lab1\logbook.cpp(9) : error C2143: syntax error : missing ';' before '{'
-
f:\c projects\112\lab1\logbook.cpp(15) : error C2065: 'logMonth' : undeclared identifier
-
f:\c projects\112\lab1\logbook.cpp(16) : error C2065: 'logYear' : undeclared identifier
-
f:\c projects\112\lab1\logbook.cpp(18) : error C3861: 'daysInMonth': identifier not found
-
f:\c projects\112\lab1\logbook.cpp(21) : error C2065: 'entry' : undeclared identifier
-
f:\c projects\112\lab1\logbook.cpp(25) : error C2144: syntax error : 'int' should be preceded by ')'
-
f:\c projects\112\lab1\logbook.cpp(25) : error C2059: syntax error : ')'
-
f:\c projects\112\lab1\logbook.cpp(26) : error C2143: syntax error : missing ';' before '{'
-
f:\c projects\112\lab1\logbook.cpp(27) : error C2065: 'month' : undeclared identifier
-
f:\c projects\112\lab1\logbook.cpp(28) : error C2065: 'year' : undeclared identifier
-
f:\c projects\112\lab1\logbook.cpp(30) : error C2065: 'NumberOfDays' : undeclared identifier
-
f:\c projects\112\lab1\logbook.cpp(36) : error C2601: 'Logbook::putEntry' : local function definitions are illegal
-
f:\c projects\112\lab1\logbook.cpp(6): this line contains a '{' which has not yet been matched
-
f:\c projects\112\lab1\logbook.cpp(43) : error C2601: 'Logbook::getEntry' : local function definitions are illegal
-
f:\c projects\112\lab1\logbook.cpp(6): this line contains a '{' which has not yet been matched
-
f:\c projects\112\lab1\logbook.cpp(51) : error C2601: 'Logbook::month' : local function definitions are illegal
-
f:\c projects\112\lab1\logbook.cpp(6): this line contains a '{' which has not yet been matched
-
f:\c projects\112\lab1\logbook.cpp(56) : error C2601: 'Logbook::year' : local function definitions are illegal
-
f:\c projects\112\lab1\logbook.cpp(6): this line contains a '{' which has not yet been matched
-
f:\c projects\112\lab1\logbook.cpp(61) : error C2601: 'Logbook::daysInMonth' : local function definitions are illegal
-
f:\c projects\112\lab1\logbook.cpp(6): this line contains a '{' which has not yet been matched
-
f:\c projects\112\lab1\logbook.cpp(92) : error C2601: 'Logbook::displayCalendar' : local function definitions are illegal
-
f:\c projects\112\lab1\logbook.cpp(6): this line contains a '{' which has not yet been matched
-
f:\c projects\112\lab1\logbook.cpp(126) : error C2144: syntax error : 'int' should be preceded by ';'
-
f:\c projects\112\lab1\logbook.cpp(126) : error C2761: 'putEntry' : member function redeclaration not allowed
-
f:\c projects\112\lab1\logbook.cpp(127) : error C2601: 'Logbook::operator []' : local function definitions are illegal
-
f:\c projects\112\lab1\logbook.cpp(6): this line contains a '{' which has not yet been matched
-
f:\c projects\112\lab1\logbook.cpp(132) : error C2601: 'operator +=' : local function definitions are illegal
-
f:\c projects\112\lab1\logbook.cpp(6): this line contains a '{' which has not yet been matched
-
f:\c projects\112\lab1\logbook.cpp(140) : error C2601: 'Logbook::leapYear' : local function definitions are illegal
-
f:\c projects\112\lab1\logbook.cpp(6): this line contains a '{' which has not yet been matched
-
f:\c projects\112\lab1\logbook.cpp(148) : error C2601: 'Logbook::dayOfWeek' : local function definitions are illegal
-
f:\c projects\112\lab1\logbook.cpp(6): this line contains a '{' which has not yet been matched
-
f:\c projects\112\lab1\logbook.cpp(75) : error C2196: case value '6' already used
-
f:\c projects\112\lab1\logbook.cpp(96) : error C2065: 'cout' : undeclared identifier
-
f:\c projects\112\lab1\logbook.cpp(96) : error C2065: 'endl' : undeclared identifier
-
f:\c projects\112\lab1\logbook.cpp(132) : error C2805: binary 'operator +=' has too few parameters
-
f:\c projects\112\lab1\logbook.cpp(158) : error C2660: 'Logbook::daysInMonth' : function does not take 1 arguments
-
Build log was saved at "file://f:\c projects\112\LAB1\lab1\Debug\BuildLog.htm"
-
lab1 - 28 error(s), 0 warning(s)
-
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Down to just the 7 errors: - --------------------Configuration: Logbook - Win32 Debug--------------------
-
Compiling...
-
Logbook.cpp
-
Logbook.cpp(33) : error C2065: 'NumberOfDays' : undeclared identifier
-
Logbook.cpp(139) : error C2805: binary 'operator +=' has too few parameters
-
Logbook.cpp(141) : error C2065: 'entry' : undeclared identifier
-
Logbook.cpp(141) : error C2109: subscript requires array or pointer type
-
Logbook.cpp(141) : error C2248: 'entry' : cannot access private member declared in class 'Logbook'
-
logbook.h(43) : see declaration of 'entry'
-
Logbook.cpp(141) : error C2106: '+=' : left operand must be l-value
-
Logbook.cpp(165) : error C2660: 'daysInMonth' : function does not take 1 parameters
-
Error executing cl.exe.
-
-
Testall.exe - 7 error(s), 0 warning(s)
I love you (in a totally hetero way). GOD BLESS! THANKS!
I hope I can repay the favor sometime.
Of course, I don't know why I am getting those errors. I have seen an example, and my code looks allright.
I still get these: - ------ Build started: Project: lab1, Configuration: Debug Win32 ------
-
Compiling...
-
Logbook.cpp
-
f:\c projects\112\lab1\logbook.cpp(139) : error C2805: binary 'operator +=' has too few parameters
-
f:\c projects\112\lab1\logbook.cpp(141) : error C3861: 'daysInMonth': identifier not found
-
f:\c projects\112\lab1\logbook.cpp(143) : error C2065: 'logMonth' : undeclared identifier
-
f:\c projects\112\lab1\logbook.cpp(143) : error C2248: 'Logbook::logMonth' : cannot access private member declared in class 'Logbook'
-
f:\c projects\112\lab1\logbook.h(41) : see declaration of 'Logbook::logMonth'
-
f:\c projects\112\lab1\logbook.h(10) : see declaration of 'Logbook'
-
f:\c projects\112\lab1\logbook.cpp(144) : warning C4390: ';' : empty controlled statement found; is this the intent?
-
f:\c projects\112\lab1\logbook.cpp(150) : error C2065: 'entry' : undeclared identifier
-
Build log was saved at "file://f:\c projects\112\LAB1\lab1\Debug\BuildLog.htm"
-
lab1 - 5 error(s), 1 warning(s)
-
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Code: Motoma 3,237
Recognized Expert Specialist - ------ Build started: Project: lab1, Configuration: Debug Win32 ------
-
Compiling...
-
Logbook.cpp
-
f:\c projects\112\lab1\logbook.cpp(139) : error C2805: binary 'operator +=' has too few parameters
-
f:\c projects\112\lab1\logbook.cpp(141) : error C3861: 'daysInMonth': identifier not found
-
f:\c projects\112\lab1\logbook.cpp(143) : error C2065: 'logMonth' : undeclared identifier
-
f:\c projects\112\lab1\logbook.cpp(143) : error C2248: 'Logbook::logMonth' : cannot access private member declared in class 'Logbook'
-
f:\c projects\112\lab1\logbook.h(41) : see declaration of 'Logbook::logMonth'
-
f:\c projects\112\lab1\logbook.h(10) : see declaration of 'Logbook'
-
f:\c projects\112\lab1\logbook.cpp(144) : warning C4390: ';' : empty controlled statement found; is this the intent?
-
f:\c projects\112\lab1\logbook.cpp(150) : error C2065: 'entry' : undeclared identifier
-
Build log was saved at "file://f:\c projects\112\LAB1\lab1\Debug\BuildLog.htm"
-
lab1 - 5 error(s), 1 warning(s)
-
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Just quickly:
Operator += is a binary operator; it takes two arguments, a left and a right element.
Operator += is not in the Logbook namespace, therefor you will need to reference daysInMonth() as Logbook::daysIn Month(). Same goes for logmonth.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Alex Endl |
last post by:
ok now that i know the random function, i made this guessing game. I get an
error though, and Im new so im not to good at figuring out what its talking
about.
import random
a = random.randint(1, 100)
b=-100
c=0
print "Welcome to guess the number"
|
by: bill wilson |
last post by:
Hi folks,
I am new to php+mysql, can anyone help on this query?
If we have a table
id name
1 allen
2 bill
3 mark
15 david
|
by: KK |
last post by:
Design Pattern help for this scenerio?.
I need some expert advice on possible ways
to design the classes for following scenerio.
Subject domain has 3 types of identities.
Lets say <IDType1>, <IDType2>. Because
both are identities and have some
commonality we can inherit them from a
base <Identity> type.
|
by: MDOPro |
last post by:
A pal needs help on this site
greetings fellow newsgroupers. I recently found a site called Microsoft
Forums. In a very short time I became very known to the site and its an
excellent tool. This guy who runs it is good too but needs a helping hand.
Please do me a favor and check it out at http://www.msforums.org/
|
by: TN Bella |
last post by:
Hi,
I am trying to get my compare validator to fire properly...Since I have
panels the validator wouldn't work properly, the app would fire right
but would insert the data regardless and the user couldn't fix an error
if they had an error. So I added another sub and fixed the panels, but
the compare validator still doesn't work right.
Right now the validator pops up with the error that the two values
(txtAcctAmtSum and txtInvAmt) are...
| |
by: Merdelus |
last post by:
I'm a new visual basic learner, I need some help with this
program below:
create an application that either sums or averagethe rows
or columns of a two dimensional array depending on user
choices.
create a menu bar with a file that includes a perform
action command and an exit command. the perform action
command computes either the sum or the average of the rows
or columns in the array and displays the result in a
|
by: MK |
last post by:
Hello,
I am new to XML and PERL and I have a few questions the answers to
which I need to complete a project. All your time and effort would be
highly appreciated. I have to make a small HTML page which would take
in as input the state code, of the 50 states belonging to the Unites
States of America. After the user enters the two letter code and
presses the "GO" button, a *.xsd file is parsed to retrieve
information about the entire state...
|
by: shantanuaggarwal |
last post by:
Hi,,
I have one following question that whether attributes can help me in resolving this problem:
I have one base class called Employee
and I have 3 classes which inherit it:
EmployeeA
EmployeeB
EmployeeC
|
by: flavourofbru |
last post by:
Hi,
I am stuck at a major part of the code in VC++.
My algorithm is as follows:
f_name = load(filename);
//this also loads a text file. The text files contains numbers sepearted by tab. it has 4 columns in it.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |