Need help/ teacher in C++

I just started C++ this semester and i have a horrible techer that i cant understand. And to make it even worse he is the only teacher for it at my campus. So if anyone would like to help me out. And teach me a few things i would appreciate it.
Heyas!

What specifically do you need help with? We really appreciate it when we're asked specific questions. :)

-Albatross
I just want to learn the basic of c++ I really want to learn how to program but I have no idea how to do it.
Hello I am creating a bank program for an online c++ class the instructor has not got back to me on my request any help would be appriciated. The program deals with classes and exceptions. I need to create an array of four checking account objects that calls the bank constructor which might throw an exception. I got all this done correctly I think. My problem now is I need to display which account threw the exception and display all account info only if all account numbers are good(account number must be between 1000 and 9999. here is my code

#include "stdafx.h"
#include<iostream>
#include<string>
#include<conio.h>
#include<exception>
using namespace std;

class Bank
{
protected: //Protected variables
int acctNumber;
double balance;
public:
Bank(); //constructor
void display();
};
Bank::Bank()//constuctor used to enter data
{
string message = "Account numbers must be four digits";
cout << "Enter Account Number "; cin >> acctNumber;
try
{
if(acctNumber < 1000 || acctNumber > 9999)
{
throw(message);
}
}
catch(string message)
{
cout << message << endl;
acctNumber =0;
balance =0;
}

cout << "Enter Balance "; cin >> balance;
}
void Bank::display()
{
cout << "Account Number: " << acctNumber << endl;
cout << "Balance $ " << balance << endl;
}
class SavingsAccount : virtual public Bank
{
friend ostream& operator<<(ostream&, const SavingsAccount&);// creates overloaded insertion operator
protected:
double rate;
public:
SavingsAccount();
};
SavingsAccount::SavingsAccount() : Bank()
{

cout << "Enter Interest Rate "; cin >> rate;
}

ostream& operator<<(ostream& out, const SavingsAccount& Savings )// overlaoded insertion operator function
{
cout << "Savings Account:" << endl;
cout << "Account #";
out << Savings.acctNumber << " " << endl;
cout << "Balance $";
out << Savings.balance << endl;
cout << "Interest Rate ";
out << Savings.rate;
cout << endl;
return out;
}
class CheckingAccount : virtual public Bank
{
protected:
int numChecks;
double monthlyFee;
public:
CheckingAccount();
void checkingDisplay();
};
CheckingAccount::CheckingAccount() : Bank()
{

cout << "Enter Monthly Fee "; cin >> monthlyFee;
cout << "Enter Number Of Checks Allowed Per Month "; cin >> numChecks;
cout << endl;
}
void CheckingAccount::checkingDisplay()
{
cout << "Account Number: " << acctNumber << endl;
cout << "Balance $ " << balance << endl;
cout << "Monthly fee $ " << monthlyFee << endl;
cout << "Checks allowed per month " << numChecks << endl;
}
class checkingWithInterest : virtual public SavingsAccount, virtual public CheckingAccount //multiple inheritance
{
public:
checkingWithInterest();
void display();

};
checkingWithInterest::checkingWithInterest():
Bank(), SavingsAccount(), CheckingAccount()
{
rate = .02;
}
void checkingWithInterest::display()
{
cout << "Checking With Interest Account: " << endl;
cout << "Account Number " << acctNumber << endl;
cout << "Account Balance $" << balance << endl;
cout << "Rate For This Account Is " << rate << endl;
cout << "Monthly Fee $" << monthlyFee << endl;
cout << "Checks Allowed Per Month " << numChecks << endl;
cout << endl;
}
class BankAccountException : virtual public Bank
{
private:
string message;
public:
BankAccountException();
void displayMessage();
};
BankAccountException::BankAccountException() :Bank()
{
message = "Invalid Data";
try
{
if(acctNumber < 1000 || acctNumber > 9999)
{
throw (message);
}
}
catch(string message)
{
displayMessage();
acctNumber = 0;
balance = 0;
}

}
void BankAccountException::displayMessage()
{
string message = "Account numbers must be four digits";
cout << message;
}

int main()
{
const int size = 4;
int x;
CheckingAccount checking[size];

for(x=0; x<size; ++x)
{
checking[x];
}

for(x=0; x<size; ++x)
{
checking[x].display();
}

cout << "Press any key to continue . . .";
_getch();
return 0;
}
Don't hijack threads spottedowl.

Do you have a book for the class?
cloud0005 wrote:
I just want to learn the basic of c++
There are some great tutorials on this website (see: http://www.cplusplus.com/doc/tutorial/).

If you find yourself stuck on a specific topic, feel free to post in these forums and I'm sure someone will help you out!

Good luck and I hope this helps.
Topic archived. No new replies allowed.