D
d.j.
I want this program to stop after you enter 0 in for the customer number
and not have to enter 0 for all fields before it ends. Please help.. Thanks
#include <iostream.h>
int main()
{
float principle = 1;
float ni = 1; // number of payments per year
int count = 0;// total loans processes
int cust = 1; //customer number
float intrest = 1;// interest charges
float tpay = 0;//total payments
float rate = 1;//intrest in percentages
while (principle != 0)
{
cout <<"\nEnter customer number\n";
cin >> cust;
cout <<"\nEnter payments per year\n";
cin >> ni;
cout << "\nEnter intrest charge\n";
cin >> intrest;
cout << "\nEnter principal loan amount\n";
cin >> principle;
cout << "\Enter total numbers of payments\n";
cin >>tpay;
if (principle == 0)
cout << "the end\n";
else count++;
if (principle > 0)
rate = (2 * ni * intrest* 100) / (principle * (tpay + 1));
if (principle>0)
cout << "customer number & principle loan amt: "<< cust << " " <<
principle << " ";
if (principle > 0)
cout << " Interest in percentages " << rate << " % " << '\n';
}
cout << "Total loans processed " << count << '\n';
return 0;
}
and not have to enter 0 for all fields before it ends. Please help.. Thanks
#include <iostream.h>
int main()
{
float principle = 1;
float ni = 1; // number of payments per year
int count = 0;// total loans processes
int cust = 1; //customer number
float intrest = 1;// interest charges
float tpay = 0;//total payments
float rate = 1;//intrest in percentages
while (principle != 0)
{
cout <<"\nEnter customer number\n";
cin >> cust;
cout <<"\nEnter payments per year\n";
cin >> ni;
cout << "\nEnter intrest charge\n";
cin >> intrest;
cout << "\nEnter principal loan amount\n";
cin >> principle;
cout << "\Enter total numbers of payments\n";
cin >>tpay;
if (principle == 0)
cout << "the end\n";
else count++;
if (principle > 0)
rate = (2 * ni * intrest* 100) / (principle * (tpay + 1));
if (principle>0)
cout << "customer number & principle loan amt: "<< cust << " " <<
principle << " ";
if (principle > 0)
cout << " Interest in percentages " << rate << " % " << '\n';
}
cout << "Total loans processed " << count << '\n';
return 0;
}