Program Issue
Feb 1, 2015 at 8:12am UTC
I'm having an issue involving my program that I'm writing for my C++ class in college. The issue involves after the code
1 2 3
cout << "The average daily balance is: " << ((netBalance * d1 - payment * d2) / d1) << endl; //Output
cin >> averageDailyBalance; //Input
cout << endl;
nothing else displays. Here is all my code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
//Program that accepts input netBalance, payment, d1, d2, and interest rate per month.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double netBalance;
int d1; //Number of days of billing cycle.
int d2; //Number of days payment is made before billing cycle.
double payment;
double averageDailyBalance;
double interest;
double interestRate;
cout << "Enter the net balance:" ; //Output
cin >> netBalance; //Input
cout << endl; //Output
cout << "Enter the number of days of the billing cycle:" ; //Output
cin >> d1; //Input
cout << endl; //Output
cout << "Enter the number of days payment is made before billing cycle:" ; //Output
cin >> d2; //Input
cout << endl; //Output
cout << "Enter the payment made:" ; //Output
cin >> payment; //Input
cout << endl; //Output
cout << "The average daily balance is: " << ((netBalance * d1 - payment * d2) / d1) << endl; //Output
cin >> averageDailyBalance; //Input
cout << endl;
cout << "Enter intrest rate: " ;
cin >> interestRate;
cout << endl;
cout << "The interest is: " << averageDailyBalance * 0.0152 << endl; //Output
cin >> interest; //Input
cout << endl; //Input
return 0;
}
Feb 1, 2015 at 9:08am UTC
What do you mean nothing else is output? Does the program crash? Lock up? Report some error?
Feb 1, 2015 at 3:18pm UTC
Its bcuz the control is asking u to input some number for averageDailyBalance as u are using
cin>>averageDailyBalance;
Therefore,it waits till you enter any value and after that it will show the output of the rest program code..
Topic archived. No new replies allowed.