Hello I am having some problem, can any body give me a helping hand

each time I compile I get this error massage, I dont know where I made the mistake help please I new to programming

This is my Main File

include libraries
	#include <iostream>									//Call C++ normal imput and output library
	#include <fstream>									//Standard Library C++ class with constructors, a destructor and overloaded operators.
	#include <windows.h>								//Standard Windows Operations Library 
	#include <cmath>									//Standard Library Mathematical Operations 
	#include <iomanip>									//Standard Formatting Operations  
	#include "M_Calculator.h"							// Call for information from mortage payment file

	using namespace std;
	 
	//function prototypes
	void Assignment();
	void Loop(MortgageCal&);
	void MenuDisplay();
	void Display(double, double, double, int);
	bool Exit();
	void ClearScreen();
	 
	//Main function and assignment function
	void main()
	{
		Assignment();
	}
		void Assignment()
	{
		//variables to be assinged by the user
		double principle, interest, balance;			//Assinged principle
		int term;
		int answer;
		int const SIZE = 3;
		//Starting of arrays
		int t[]   = { 7, 15, 30 };						//Assinged term
		double i[SIZE];									//Assinged interest
		
		ifstream fin;
		fin.open("InterestCal.txt");					//Call external Interest file
		for (int j = 0; j < SIZE; j++)
		{
			fin>>i[j];
		}   
	 
		//Screen display and user to input values
		cout << endl;
		cout << "\n";														//Add space on screen
		cout <<"\t"<< " *************************************************************" << endl;
        cout <<"\t\t\t"<< "------- Title Of Program-------- "<< endl;		// Display Title for the program
		cout <<"\t\t"<<" C++ Object-oriented Calculates Mortgage Program Week 4 "<< endl;
		cout <<"\t\t\t\t"<<"Created by Carl Cargill "<< endl;				// Display Author of the program
		cout <<"\t"<< " *************************************************************" << endl;
		cout << "\n";
		cout <<"\t"<<"Here is your Caclulator, Fellow instuction to get the right results "<< endl;
		cout << "\n";
		cout<<"\t Please Enter Your Mortage amount you want: $ ";
		cin>>principle;
		MenuDisplay();
		cin>>answer;									//holds the answer to user input based from menu display
		switch(answer)
		{
			case 1 : interest = i[0];
					 term = t[0];
					 break;
			case 2 : interest = i[1];
					 term = t[1];
					 break;
			case 3 : interest = i[2];
					 term = t[2];
					 break;
			default : cout<<"\tPlease fellow instruction and enter (1), (2) or (3)"<<std::endl;
					  Assignment();
					  break;
		}
	 
		MortgageCal UseMort(principle,interest,balance,term);	//create an instance of Mortgage Calculator vie the overloaded constructor
		Loop(UseMort);									//callign Loop function passing in a reference of Amortisation
	}
		void Loop(MortgageCal &UseMort)					//the loop function references an instance of Mortgage Calculation
	{
		double principle;
		int months;
		principle = UseMort.GetPrinciple();
		months = UseMort.GetTerm() * 12;				//convert the term into total months
		int i, j = 1;									//counters
		for(i = 1; i < months; i++)						//the start of our loop using the total number of months as our counter
		{
			principle -= UseMort.GetMonthlyPayment();	//change principle to relflect payment
			UseMort.SetPrinciple(principle);			//update the principle member variable to the new principle
			Display(UseMort.GetMonthlyPayment(), UseMort.GetMonthlyInterestPaid(), UseMort.GetBalanceOwed(),i);
	
			
			//Pause programe on every 12th month
			if(j == 12)
			{
				system("PAUSE");
				j = 1;
			}
			else
				j++;
		}
		//validate if the user want to input new data, and reacts to any response from the user
		if(Exit() != true)
		{
			UseMort.~MortgageCal();
		}
		else
		{
			UseMort.~MortgageCal();
			ClearScreen();
			Assignment();
		}
	}
	//Print out Menu Display on screen for user to make selection
	void MenuDisplay()
	{
		cout << "\n";
		cout<<"\tHere is your Interest Menu choices below:"<<std::endl;
		cout << "\n";
		cout<<"\tSelect a choice below by entering (1), (2) or (3) on your keyboard"<<std::endl;
		cout << "\n";
		cout<<"\t(1) 7 year term at 5.35% interest"<<std::endl;
		cout<<"\t(2) 15 year term at 5.5% interest"<<std::endl;
		cout<<"\t(3) 30 year term at 5.75% interest"<<std::endl;
	}
	//Display function, after use selection will display result
	void Display(double monthlyPay, double interestPay, double balanceOwed, int month)
	{
		cout<<"\tMonth\tPayment \tInterest"<<std::endl;	
		cout<<"\t-----\t------- \t-------- \t--------"<<std::endl;
		cout<<"\t"<< fixed << showpoint << setprecision(2)<<month<<"\t"<<monthlyPay<<"  \t"<<interestPay<<"  \t"<<balanceOwed<<std::endl;
		cout << "\n";
		cout << "\n";
	}
	 
	//Exit function, and question the user on there way forward
	bool Exit()
	{
		char exit = 'i';
		cout<<"\n\nTo carry out a next calclulation or end program (y = yes or n = no) : ";
		cin>>exit;
		if(exit != 'y' && exit != 'n')						//check to make sure input is what its suppose to be
		{
			cout<<"\n Please fellow instruction you must enter (y = yes or n = no)."<<std::endl;
			Exit();
		}
		if(exit == 'y')
			return true;
		else
			return false;
	}
	//Clear Screen function, retives buffer and count rows & colum to clear and start back at 0,0 co0rdinate
	void ClearScreen()
	{
		HANDLE StdOut = GetStdHandle(STD_OUTPUT_HANDLE);
		CONSOLE_SCREEN_BUFFER_INFO Buflnf;
		COORD Origin = {0,0};
		DWORD LenWrt;
	 
		GetConsoleScreenBufferInfo(StdOut, &Buflnf); //Get screen rows and columns
	 
		int ChrCnt = Buflnf.dwSize.X * Buflnf.dwSize.Y;
	 
		FillConsoleOutputAttribute(StdOut, Buflnf.wAttributes, ChrCnt, Origin, &LenWrt);
		FillConsoleOutputCharacter(StdOut,' ', ChrCnt, Origin, &LenWrt);
	 
		SetConsoleCursorPosition(StdOut, Origin);
	}


This is my Header file

class MortgageCal
{
	private:
		//variables
		double cal_principle;									//initial value of the loan amount
		double cal_interest;									//initial interest towards the loan
		double cal_balance;
		int   cal_terms;										//initial term length of loan (years)
	public:
		//constuctor is over loaded
		MortgageCal();											//default constuctor
		MortgageCal(double,double,double,int);					//over loaded constuctor takes 4 paramaters
		
		//default destructor
		~MortgageCal() {}
		
		//Set inline methods
		void SetPrinciple(double p) { cal_principle = p; }
		void SetInterest(double i)  { cal_interest = i; }
		void Setbalance(double b)  { cal_balance = b; }
		void SetTerm(int t)	        { cal_terms = t; }
		
		//Get the inline methods and All methods are constants to ensure no data is changed
		const double GetPrinciple() const { return cal_principle; }
		const double GetInterest() const  { return cal_interest; }
		const double GetBalanceOwed() const  { return cal_balance; }
		const int GetTerm() const         { return cal_terms; }
		
		//another go getter function methods
		const double GetMonthlyPayment() const;
		const double GetMonthlyInterestPaid() const;
		const double GetMonthlyBalanceOwed() const;
};
 
//Variable constructor and Initialize predetermined values
		MortgageCal::MortgageCal() :
		cal_principle(),
		cal_interest(),
		cal_balance(),
		cal_terms()
		{
		}
//Overloaded constructor which initialize member variables based on parameter values (principle, interest, term)
		MortgageCal::MortgageCal(double p, double i, double b, int t) :
		cal_principle(p),
		cal_interest(i),
		cal_balance(b), 
		cal_terms(t)
		{
		}
//Get Monthly Payment Method,and working out of payment and return
	const double MortgageCal::GetMonthlyPayment() const
	{
		//calculating the montly payment and return monthly amount
		double mnthPayment;
		mnthPayment = (cal_principle * (cal_interest/12)) / (1.0 -pow(1.0/(1.0+(cal_interest/12)),12 * cal_terms));
		return mnthPayment;	
	}
//Get Monthly Interest Paid Method and Calculates the monthly interest paid and returns
	const double MortgageCal::GetMonthlyInterestPaid() const
	{
		double interestPaid;
		//calculating the interest paid and return interest paid
		interestPaid = (cal_principle * (cal_interest/12));
		
		return interestPaid;
	}

	//Get Monthly Balance owed Method and and working out of Balance and return
	const double MortgageCal::GetMonthlyBalanceOwed() const
	{
		double balanceOwed;
		//calculating the Balance Owed and return Balance Owed
		balanceOwed = (cal_principle - (cal_principle/12));
		
		return balanceOwed;
	}


This is my Text File

0.0535
0.055
0.0575

What error message?

Saying "...each time I compile I get this error massage,..." is too generic, it's not helpful.

Give us specifics and we may be able to help... If what is Line 3 in your "snippet" is actually in your code, I'm not surprised there is an error. That should be a comment, which it definitely isn't.

1>------ Build started: Project: Wk4-2, Configuration: Debug Win32 ------
1>Compiling...
1>WK4_AssT.cpp
1>d:\school information-may 15-10(12-15pm)\av-twentyone -prg411 c++ programming ii--5-4-2010_6-7-2010\week4-2\wk4-2\wk4-2\wk4_asst.cpp(103) : warning C4700: uninitialized local variable 'balance' used
1>Linking...
1>LINK : fatal error LNK1168: cannot open D:\School Information-May 15-10(12-15pm)\AV-TwentyOne -PRG411 C++ PROGRAMMING II--5-4-2010_6-7-2010\Week4-2\Wk4-2\Debug\Wk4-2.exe for writing
1>Build log was saved at "file://d:\School Information-May 15-10(12-15pm)\AV-TwentyOne -PRG411 C++ PROGRAMMING II--5-4-2010_6-7-2010\Week4-2\Wk4-2\Wk4-2\Debug\BuildLog.htm"
1>Wk4-2 - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Either the program is already running or you simply don't have write access to that directory.

Here is the error

And this after the program is complied can some body tell why this is happening.

Run-Time Check Failure #3 - The variable 'balance' is being used without being initialized,

uninitialized local variable 'balance' used

try

float balance=0; //where float is the type of balance
what compiler are you using ? reminds me of borland 5.5 but could be vc ?

also if on windows ctrl alt delete and check processes to make sure your program isnt already running
report any other errors or warnings you get

I am using MS VC, Any one find a way I can get out of this problem,

The variable "balance" is declared (but NOT initialized) on Line 29, you do absolutely nothing else with it until you send it to MortgageCal() on Line 75.

All you have to do is change Line 29 to include initializations, it's not that difficult...

int uninitializedInt;    //declaration only

int initializedInt = 0;  //declaration and initialization

I try that and it did not work here is the error massage

1>------ Build started: Project: Wk4-2, Configuration: Debug Win32 ------
1>Compiling...
1>WK4_AssT.cpp
1>d:\school information-may 15-10(12-15pm)\av-twentyone -prg411 c++ programming ii--5-4-2010_6-7-2010\week4-2\wk4-2\wk4-2\m_calculator.h(31) : error C2864: 'MortgageCal::initializedInt' : only static const integral data members can be initialized within a class
1>Build log was saved at "file://d:\School Information-May 15-10(12-15pm)\AV-TwentyOne -PRG411 C++ PROGRAMMING II--5-4-2010_6-7-2010\Week4-2\Wk4-2\Wk4-2\Debug\BuildLog.htm"
1>Wk4-2 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Can some please help me I try all I know and I don't know much

The error message is both explicit and helpful here:
at line 31 of m_calculator.h, you attempted, in the context of a class declaration, to initialize a member variable InitializedInt. You cannot specify the value of a member variable (for an instance of the class) when you are declaring the class (telling the compiler what the layout is). The basic idea is that you specify a class data member's type in the class declaration (header file) and you initialize it with a value in the constructor (.cpp or .cc file)

Listen, if you can not help.................please dont post here, if I have come this far and i can not do it and ask for help it because i have tried every thing and it have not work that is why I am asking for help.

This is not some one that was coding before now

I/We am/are helping you. Everyone was a newb/rookie/novice etc. at some point, most members here understand that.

It's obvious that you tried to cut/paste the code I posted into yours hoping it would work, hence my previous comments (did you bother to read the link?). The variable names "uninitializedInt" and "initializedInt" are intentionally completely irrelevant to your program, they are generic names used as part of an example of a useful concept and nothing more. If you can't realize that and modify your treatment of the variable named "balance" (as well as any others) to be similar to eht provided example, that is not our fault.

The best help someone can give is to guide a person to accomplish the task themselves. Making them think about it makes them learn it better. Giving someone the solution on a silver platter accomplishes absolutely nothing.

Look at Griswold's post then post the most recent version of your own code. Once that is up, it may be possible to assist you further.

class's use objects. where or better yet what is your object
look good resources are

http://www.cprogramming.com/ <- only use that one upto classes and then skip till you hit recursion then use the next link
http://www.cplusplus.com/
go through ALL tutorials there and reread them until you can cite them from memory or at least until you can understand the syntax
im only 17 but i get it and if i can do it then so can you :)

here is an example

#include <iostream>
using namespace std;
class myclass{
public:
int x;
};  // i can not stress how many times people forget the semi AFTER the class
int main(){
myclass myobject; // an object is an instance of a class
myobject.x=10; // x is a member of instance myobject which is assigned 10
cout<<myobject.x; //if you dont know this then you shouldnt be programming because your not applying yourself
return 0;
}

Listen I didnt come here because I don't want to learn, but after working on any thing for days any body reach a point where they just want some one to just show/tell them how to do it,

I did ask for help after the due date of my assignment, now some of you have been doing this for years, some of us are just doing it for the first time, to be honest I am sorry that I came here for any help and please dont post me nay help if you are not going to give help, and yes maybe I am not supose to be doing programming but it part of getting my education, you all did not look at the amount of work done before I came here, just dont reply to this post.

Thank you all and bye

why create a blog to help if that is not what you are doing.

Dont reply to my post, I dont need your help

Look, we've told you exactly what your problem is, and how to fix it. At this point it is up to you to make the suggested changes. If the changes you made didn't work, give us more information. The current version of your code and the errors you are getting would be helpful to us. Without current information, there's not much more that can be done.

We're trying to help you, it's not that we won't help, it's that we can't. Help us help you, give us the information we need, we're not psychics.

oh and what i meant by the comment above is that if you dont know the cout function then you shouldnt be doing this
i didnt really mean that you shouldnt. we could always use more programmers :)

if you would post the contents of the header we can help you further.
what they mean by give help is that you need to help us help you by posting the contents of the header and telling us what you have and have not tried to remedy the situation.

without knowing the contents of M_calculator.h we cant tell you exactly where it is
but as far as i know you have a function or a reference to balance somewhere where its not initialized I.E. type balance; instead of type balance=0;

Here is some helpful advice if the compiler spits out an error such as

/home/avarionist/C++/Testing/main.cpp|7|error: ‘x’ was not declared in this scope|

the error will occur either on the line or before it never after it. so if my program had 30 lines of code and i got an error on line 17 then it will occur on that line or before it Never after it. useful knowledge for error hunting :)

in your case i believe the error is in the header "M_calculator.h" where one of your functions has referenced it.

you may or may not know this but the compiler or rather the precompiler will go through both your header and your code and find syntax errors.
so if you have an error in your header then you need to fix it regardless if you didnt use the part with the error.

everyone would like to see the M_calculator.h so we can help you further if need be.
start out like i did go through the links i posted thats where i learned a majority of what i know the rest was through trial and error and help from programming communities like this one ;)
by the way i am only 17 been programming since i was 15. i still havent even covered most of the c++ container ie stacks and linked lists and most of the stl library like strtok();

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.