I need a little help with the below if statement. What i would like to have happen is for the loop caused by the first if statment to also be conditional to a second if statement that will pause the loop output and require user interaction to either continue displaying the looped information or quit. My thought was to pause the loop after every 12 lines of output and require the user to continue or exit the loop. Any help is greatly apreciated. As you can see below i was not succeful in my attempt. Thanks again.

for (int a = 1; a < months+1; a++)
	{
	if (a < months){
	currInt = principal * interest;
	principalPaid = payment - currInt;
	principal = principal - principalPaid;
cout << "Payment Number" << "\tPayment Amount" << "\tInterest Paid" << "\tBalance "<< endl;
cout << a << "\t\t$" <<payment << "\t$" <<currInt << "\t\t$" <<principal << endl;
[B]if (a = months+12){
          cout << "Would you like to Continue (Y/N)?\n";
           cin >> R;
           while (R == 'y'  ||  R == 'Y');
return 0;[/B]
	}
            }
	else {
cout << endl;
cout << a << "\t*******Your loan is paid in FULL!!*******" << endl;
}

I have not seen your code thoroghly but the immediate thing I would like to point out it this: if (a = months+12){ as you may see you have used a = rather than ==. In c++( and even in C) = will always evaluate true. To test for a condition == should be used.
So change it too ==.

OK. I have changed the conditional operator to the == and the additional bracket has been added but now the output will stop after the first line of output data. I guess i may not be evaluating the months + 12 condition correctly. I originally wanted it to stop after every 12 lines of output data and ask to continue. I think im almost there but still need a little more assistance.

if (a == months+12){
	cout << "Would you like to Continue (Y/N)?\n";
	cin >> R;
	} while (R == 'y'  ||  R == 'Y');
	return 0;

>>I originally wanted it to stop after every 12 lines of output
Your condition is wrong.
Basically you want to stop at every multiple of 12. that is when a is 12,24,36...
That is a divided by 12 should yield no remainder.
So change your condiditon to :

if(a %12==0)

Problem solved for my first question. I thank everyone for your help.
I solved the problem as follows.

//Beak loop for every 15 lines of displayed payments	  
		  if( a %15== 0)
			{
				cout << "Press Enter to continue.";
				cin.get();
			}
		  }

Next question:
I know the text highlighted in red below is incorrect. So, i am asking if anyone knows of how i can validate whether or not the user has entered a number and if they did not enter a number then i want to offer them to re-enter information or exit the program. I have searched both my educational document and the net and keep coming back to first converting the user input data into a string and then validate each character in the string. However, i do not want to go this far with this code at all. I simply want to validate if it is a number or not and then throw an error and ask to re-enter the entry. If you kind programming gurus believe the string validation is the best method then please give me an example of how to do this with ease. I appreciate your help immensly.

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

using namespace std;

int main()
{
	char R; //response variable
    do{
	//Declaring variables
	float loanAmt;  
	int months;    
	int loanTerm;   
	float loanRate;  
	float principal;
	float principalPaid;
	float currInt;
	float payment, interest; 
	//Beginning of user input data
         cout << endl;
	     cout << "Enter the Loan Principal Amount: ";
         cin >> loanAmt;
		 if (!isdigit(R))
		 {
			cout << "You entered an invalid Loan Amount" <<endl;
			cout << "please enter a valid amount." <<endl;		
			return main();  
		 }
This article has been dead for over six months. Start a new discussion instead.