October 8th, 2009, 12:49 AM
#1
Homework help please
Hello, I am having trouble with my homework. I have little experience in C++.
I have to make a C++ program that will determine whether a store customer has exceeded the credit limit on a charge account.
I've included a pic of what the output is supposed to be
This is what I have so far:
#include <iostream>
using namespace std;
int main()
{
int account = 0;
float balance = 0;
float charges = 0;
float credits = 0;
float limit = 0;
cout << "Enter account number 100, 200, or 300 (or -1 to quit): " << endl;
cin >> account;
if (account = 100)
{
cout << "Enter beginning balance: " << endl;
cin >> balance >> endl;
cout << "Enter total charges: " << endl;
}
return 0;
}
If anyone could give me some guidance please??
Attached Images
October 8th, 2009, 09:35 AM
#2
Re: Homework help please
Your problem is in this line
If you use the '=' operator, the account will be set to 100. You should use the '==' operator to check values. This can be done like this:
October 8th, 2009, 10:28 AM
#3
Re: Homework help please
Code:
cin >> balance >> endl;
This should be:
How do you expect to read your input into a linebreak?
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width