I should go to this program mentioned below. make a double loop (do ... while) to suppress an incorrect daily calculation!note ::::
work with a char variable "error" for erroneous daily calculation.
In contrast to the origin program, deposit and payout data should be requested again for a result of the daily bill of 0 or a number in the minus area!
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
main ()
{
char error = "n";
int e_tag, e_mon, e_jahr, a_tag, a_mon, a_jahr, days;
float capital, interest rate, interest rates;
do
{
error = "n";
cout << "
<snip>
cin >> e_tag, cin >> e_mon; cin >> e_jahr;
if (e_tag <1 || e_tag> 30 || e_mon < 1 || e_mon> 12 ||
e_year <1960 || e_year> 2002);
{
error = "j";
cout << "
Wrong date - enter again";
}
} while (error == "j");
do
{
error = "n";
cout << "
Enter the disbursement date:";
cin >> a_tag, cin >> a_mon; cin >> a_jahr;
if (a_tag <1 || a_tag> 30 || a_mon <1 || a_mon> 12 ||
a_year <1960 || a_year> 2002)
{
error = "j";
cout << "
Wrong date - enter again";
}
} while (error == "j");
days = a_tag - e_tag + (a_mon - e_mon) * 30 + (a_year - e_year) * 360;
if (days <= 0)
cout << "
Enter the capital "cin >> capital;
cout <<"
Enter the interest rate "; cin >> interest rate;
interest = capital * days * interest rate / (100 * 360);
printf ("
% s% 20.2f % s "," Interest rates ", interest," EUR ");
}
getch ();
}
Can someone help me there any further ?