Hi, when i compile this code, it has loads of errors, but its out of a book im learning from.
its...
[tag] This is the header file it tells me to make [/tag]
Code:
// Savings - define a class that includes the ability
// to make a deposit
class Savings
{
public:
// declare but dont define member function
float Deposit(float ammount);
unsigned int accountNumber;
float Balance;
};
[tag] This is the main part - its only a small crappy thing but im learning [/tag]
Code:
// SavingsClassInline - invoke a member function thats
// both declared and defined within
// the class student
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
#include "savings.h"
int main(int nNumberofArgs, char* pszArgs[])
{
savings s;
s.accountNumber = 123456;
s.balance = 0.0;
// now add something to the account
cout <<"Depositing 10 to the account " << s.accountNumber <<
endl;
s.Deposit(10);
cout <<"Balance is " << s.balance << endl;
// wait until the user is ready before terminating the program
// so the user can view the results
system("PAUSE");
return 0;
}
[tag]the errors are[/tag]
Code:
12 c:\docume~1\reece\mydocu~1\saving~1.cpp
`savings' undeclared (first use this function)
12 c:\docume~1\reece\mydocu~1\saving~1.cpp
(Each undeclared identifier is reported only once
12 c:\docume~1\reece\mydocu~1\saving~1.cpp
for each function it appears in.)
12 c:\docume~1\reece\mydocu~1\saving~1.cpp
parse error before `;'
13 c:\docume~1\reece\mydocu~1\saving~1.cpp
`s' undeclared (first use this function)
please help me out. cheers. Hugo.