Hi, I am new to this forum and I am having trouble with my interactive while loop. I can't get my program to loop three times, it will only loop once and it won't register my formula and just keeps my inventory balance the same- when it's supposed to change. Any help would be most appreciated.
int main()
{
const int MAXNUMS = 3;
int count;
double balance, received, sold, idNum;
cout << "\nThis program will ask you to enter "
<< MAXNUMS << " numbers.\n";
count = 3;
balance = 0;
cout <<setiosflags(ios::fixed) <<setprecision(3);
while (balance <= count){
cout << "Enter a book identification number\n";
cin >> idNum;
cout << "What is the inventory balance at the beginning of the month?\n";
cin >> balance;
cout << "What many copies were received this month?\n";
cin >> received;
cout << "How many copies were sold this month?\n";
cin >> sold;
balance = balance + received - sold;
cout << "The balance is now " << balance;
++count;
}
cout << "\n\nThe final balance is " << balance << endl;
I see what it is now. Change "count = 3" to "count = 0" and the while loop in my previous post.
Helpful pointers? No, sorry. I'm still fairly new and I have asked for help a few times on here. But reading through some of the posts on this forum has helped me.
Hey, one more question. So, my program is going through three loops like it should and the formula is working too, but it is not giving me the correct final balance-- it's just giving me the results of the third loop. Any suggestions?