Hey, I am a total newbie I need help finding errors in my code.

// Week 4 Individual Assignment 
// Calculate the monthly payment User input.

// Include header files

#include <iostream>
#include <iomanip>
#include <math.h>

using std::cout;
using std::endl;
using std::cin;
using std::ios;

//Namespaces
using namespace std;



//Declare and initialize variables
double Amount;
double Term;
double Interest; 
double MnthPayment;
double rPayments;
double newAmount;
double loanPrinciple;
double loanAmount;
double cMnthInterest;
double MnthAmount;
int m = 0;


int main()
{
double mInterest;
double mTerm;


bool indic=false;
char repeat;


	do
	{
		//Data Entry
		cout << "Loan amount: ";
		cin >> Amount;
		cout << endl << "Interest rate: ";
		cin >> Interest;
		cout << endl << "Term of the loan in years: ";
		cin >> Term;
		//cout << endl<< Fetching <<endl << endl;

		mInterest = Interest/(12*100);
		mTerm = Term * 12;


		// Calculate the payment
		MnthPayment = (Amount * pow((1 + mInterest), mTerm)* mInterest)/(pow((1 + mInterest),mTerm)-1.0);

		// Print out for calculations

		cout << "The mortgage payment:$" << MnthPayment <<"\n";
	        
		//prompt for repeat 
		cout <<"Would you like to calculate another loan?" << endl
			 <<"Please enter Y to repeat or any other key to exit: ";
		cin >> repeat;
		cout << endl;
		
		while (m < rPayments)
		
		//Math to figure out values for table
		MnthPayment = Interest * mInterest;
		Amount = MnthPayment - cMnthInterest;
		newAmount = loanPrinciple - MnthAmount;
		loanAmount = newAmount;

			// Controling the size length of text
			if(m % 12 == 0)
			{
					cout<<"Enter to continue";
					cin.get();
					cout<<endl<<endl;
					cout<<setw(18)<<"Interest";
					cout<<setw(21)<<"New Principle"<<endl<<endl;
			}

			m++; 

		//Table
			cout<<setw(4)<<m;
			cout<<setw(20)<<setiosflags(ios:fixed)<<setprecision(2)<<cMnthInterest<<setw(22)<<loanAmount<<endl;

	        
		//assign user input value to control variable
		if (repeat == 'y' || repeat == 'Y') indic = true;
		else 
		{
			cout << endl <<"Thank you for using the Mortgage Calculator"
				<< endl << endl;
			indic = false;
		}


    }while(indic == true);

    return 0;

} // end

In setiosflags(ios:fixed) you only used one : instead of two for name resolution. It should be setiosflags(ios::fixed) .

Thank you that did help. I now have to find out where I left off a }

fatal error C1075: end of file found before the left brace '{'
Edit/Delete Message

I am getting these errors, I just not finding what I am missing.


error C2143: syntax error : missing ';' before ']'
error C2059: syntax error : '}'
error C2059: syntax error : 'while'
error C2059: syntax error : 'return' I am getting these errors.

// Calculate the monthly payment user input.

// Include header files


#include <iostream>
#include <iomanip>
#include <math.h>

using std::cout;
using std::endl;
using std::cin;
using std::ios;


//Namespaces
using namespace std;



//Declare and initialize variables
double Amount;
double Term;
double Interest; 
double MnthPayment;
double rPayments;
double newAmount;
double loanPrinciple;
double loanAmount;
double cMnthInterest;
double MnthAmount;
int m = 0;


int main()
{
double mInterest;
double mTerm;


bool indic=false;
char repeat;


	do
	{
		//Data Entry
		cout << "Loan amount: ";
		cin >> Amount;
		cout << endl << "Interest rate: ";
		cin >> Interest;
		cout << endl << "Term of the loan in years: ";
		cin >> Term;
		//cout << endl<< Fetching <<endl << endl;

		mInterest = Interest/(12*100);
		mTerm = Term * 12;


		// Calculate the payment
		MnthPayment = (Amount * pow((1 + mInterest), mTerm)* mInterest)/(pow((1 + mInterest),mTerm)-1.0);

		// Print out for calculations

		cout << "The mortgage payment:$" << MnthPayment <<"\n";
	        
]		//prompt for repeat 
		cout <<"Would you like to calculate another loan?" << endl
			 <<"Please enter Y to repeat or any other key to exit: ";
		cin >> repeat;
		cout << endl;
		
		while (m < rPayments)
		
		//Math to figure out values for table
		MnthPayment = Interest * mInterest;
		Amount = MnthPayment - cMnthInterest;
		newAmount = loanPrinciple - MnthAmount;
		loanAmount = newAmount;

			// Controling the size length of text
			if(m % 12 == 0)
			{
					cout<<"Enter to continue";
					cin.get();
					cout<<endl<<endl;
					cout<<setw(18)<<"Interest";
					cout<<setw(21)<<"New Principle"<<endl<<endl;
			}

			m++; 

		//Table
			cout<<setw(4)<<m;
			cout<<setw(20)<<setiosflags(ios::fixed)<<setprecision(2)<<cMnthInterest<<setw(22)<<loanAmount<<endl;

	        
		//assign user input value to control variable
		if (repeat == 'y' || repeat == 'Y') indic = true;
		else 
		{
			cout << endl <<"Thank you for using the Mortgage Calculator"<< endl << endl;
				
			indic = false;
		}
	
	}
	
}while(indic == true);

 return 0;

// end

Basic attempt with a beautifier:

// Calculate the monthly payment user input.

// Include header files


#include <iostream>
#include <iomanip>
#include <math.h>

using std::cout;
using std::endl;
using std::cin;
using std::ios;


//Namespaces
using namespace std;



//Declare and initialize variables
double Amount;
double Term;
double Interest; 
double MnthPayment;
double rPayments;
double newAmount;
double loanPrinciple;
double loanAmount;
double cMnthInterest;
double MnthAmount;
int m = 0;


int main()
{
   double mInterest;
   double mTerm;


   bool indic=false;
   char repeat;


   do
   {
      //Data Entry
      cout << "Loan amount: ";
      cin >> Amount;
      cout << endl << "Interest rate: ";
      cin >> Interest;
      cout << endl << "Term of the loan in years: ";
      cin >> Term;
      //cout << endl<< Fetching <<endl << endl;

      mInterest = Interest/(12*100);
      mTerm = Term * 12;


      // Calculate the payment
      MnthPayment = (Amount * pow((1 + mInterest), mTerm)* mInterest)/(pow((1 + mInterest),mTerm)-1.0);

      // Print out for calculations

      cout << "The mortgage payment:$" << MnthPayment <<"\n";

      ]     //prompt for repeat 
      cout <<"Would you like to calculate another loan?" << endl
      <<"Please enter Y to repeat or any other key to exit: ";
      cin >> repeat;
      cout << endl;

      while ( m < rPayments )

         //Math to figure out values for table
         MnthPayment = Interest * mInterest;
      Amount = MnthPayment - cMnthInterest;
      newAmount = loanPrinciple - MnthAmount;
      loanAmount = newAmount;

      // Controling the size length of text
      if ( m % 12 == 0 )
      {
         cout<<"Enter to continue";
         cin.get();
         cout<<endl<<endl;
         cout<<setw(18)<<"Interest";
         cout<<setw(21)<<"New Principle"<<endl<<endl;
      }

      m++; 

      //Table
      cout<<setw(4)<<m;
      cout<<setw(20)<<setiosflags(ios::fixed)<<setprecision(2)<<cMnthInterest<<setw(22)<<loanAmount<<endl;


      //assign user input value to control variable
      if ( repeat == 'y' || repeat == 'Y' ) indic = true;
      else
      {
         cout << endl <<"Thank you for using the Mortgage Calculator"<< endl << endl;
				
			indic = false;
		}
	
	}
	
}while(indic == true);

return 0;

// end

I just fixed my errors I just need to work on the logic.

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.