| | |
assignment needs a little help, well i do
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2004
Posts: 5
Reputation:
Solved Threads: 0
1) Read an integer # from the file balance.dat that represents the balance on your checkbook (Assume integer #'s only)
2)let the user enter an amount to write a check.
3)If there is enough balance to write teh check then display the message (OK to write check) if the check is overdraft 350.00, from 1-50 dollars then the bank charges 5 dollars more to cash the check so display message (OK to write check , but 5 dollars will be charged due to NSF)
4) remember to chekc if the file exists before you do anything (usethe .fail() function)
2)let the user enter an amount to write a check.
3)If there is enough balance to write teh check then display the message (OK to write check) if the check is overdraft 350.00, from 1-50 dollars then the bank charges 5 dollars more to cash the check so display message (OK to write check , but 5 dollars will be charged due to NSF)
4) remember to chekc if the file exists before you do anything (usethe .fail() function)
Okay, what part are you having trouble with? Keep in mind that if you say you haven't done anything yet, I'll tell you to get lost. If you have done something, you'll need to prove it. Why? Because this is obviously homework, it's obviously easy if you put in a little effort, and maybe I just don't like you.
I'm here to prove you wrong.
•
•
Join Date: Nov 2004
Posts: 5
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Narue
Okay, what part are you having trouble with? Keep in mind that if you say you haven't done anything yet, I'll tell you to get lost. If you have done something, you'll need to prove it. Why? Because this is obviously homework, it's obviously easy if you put in a little effort, and maybe I just don't like you.
here's what i have
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <conio.h> #include <fstream> using namespace std; int main() { int checkAmount; ifstream inBalance; ofstream outBalance; inBalance.open("balance.dat"); if (inBalance.fail()) { cout << "file balance.dat not found !!!!" << endl; getch (); exit(1); } cout << "Please enter check amount: "; cin >> checkAmount; if (inBalance <= 350) { cout << "ok to write check" << endl; } if (inBalance >= 350) { cout << "OK to write check but 5 dollars will be charged due to NSF " << endl; } if (inBalance > 100) { cout << "the bank will not pay this check" << endl; } cout << endl; outBalance.open("balance.dat") getch(); return 0; }
Last edited by alc6379; Nov 12th, 2004 at 12:48 pm. Reason: added [code] tags
Very close, but inBalance is a stream, not an integer. After you open the file, do something like this:
Then use balance and checkAmount for your conditional statements.
C++ Syntax (Toggle Plain Text)
int balance; inBalance>> balance;
I'm here to prove you wrong.
•
•
Join Date: Nov 2004
Posts: 5
Reputation:
Solved Threads: 0
can anyonehelp me
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <conio.h> #include <fstream> using namespace std; int main() { int Amount; int balance; ifstream inAmount; ofstream outAmount; inAmount.open("balance.dat"); inBalance >> balance; if (inBalance.fail()) { cout << "file balance.dat not found!!!" << endl; getch(); } cout << "Please enter check amount: "; cin >> Amount; if (balance <=350) { cout << "Ok to write check" << endl; } if (balance >=350) { cout << "The bank will not pay this check" << endl; } cout << endl; outBalance.open("balance.dat") getch(); return 0; }
>can anyonehelp me
I did help you. If you have a new question then ask it. The logic for this program is simple, so either you're very stupid, or very lazy. I prefer to assume the latter, so explain exactly what your problem is and we'll help. But we won't do it for you.
I did help you. If you have a new question then ask it. The logic for this program is simple, so either you're very stupid, or very lazy. I prefer to assume the latter, so explain exactly what your problem is and we'll help. But we won't do it for you.
I'm here to prove you wrong.
![]() |
Similar Threads
- Java Assignment Help Needed!!!!!!!!!! (Java)
- Help needed with VB Assignment (Visual Basic 4 / 5 / 6)
- Many Errors while doing this assignment (C)
- I need help on my 'address book' assignment! (C++)
Other Threads in the C++ Forum
- Previous Thread: priority queue
- Next Thread: program w/ switch AND nested if. six error messages
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game generator getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






