943,843 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 1701
  • C RSS
Jan 26th, 2009
0

Give me a chequebook balancing program.

Expand Post »
How can i make a chequebook balancing program of an user’s account?
It will use getline() to read a line, which will contain either the word “withdrawl” or “deposit”.
The next line will contain the amount of the withdrawl or deposit. After reading each pair of lines, the program should compute and print the new balance.
You can declare the variable to hold the running balance to be datatype float, and you can use the function atof() to convert an amount string read by getline() into a floating-point number.
When the program reaches end-of-file, it should exit.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
hsoni007 is offline Offline
7 posts
since Jan 2009
Jan 26th, 2009
1

Re: Give me a chequebook balancing program.

> Give me a chequebook balancing program.
How presumptuous of you that you think you can just roll in here and demand that we do your homework.

True or false - this applies to you as well as all the other noobs?
Announcement: We only give homework help to those who show effort
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Jan 26th, 2009
0

Re: Give me a chequebook balancing program.

Please give me a hint to make this program!
Reputation Points: 10
Solved Threads: 1
Newbie Poster
hsoni007 is offline Offline
7 posts
since Jan 2009
Jan 26th, 2009
0

Re: Give me a chequebook balancing program.

Salem gave you a hint already, but if you feel you need more I'll give you another.

Search for your answer first!; the first point from Read This Before Posting, at the head of the forum.
Aia
Reputation Points: 2224
Solved Threads: 218
Nearly a Posting Maven
Aia is offline Offline
2,304 posts
since Dec 2006
Jan 26th, 2009
0

Re: Give me a chequebook balancing program.

The hints in your homework seem pretty massive from where I'm sitting.

> It will use getline() to read a line
There you go, write a program using getline() and see what happens.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Jan 26th, 2009
0

Re: Give me a chequebook balancing program.

IS getline() INBUILD FUNCTION?
AND HOW IS IT WORKS?
Reputation Points: 10
Solved Threads: 1
Newbie Poster
hsoni007 is offline Offline
7 posts
since Jan 2009
Jan 26th, 2009
0

Re: Give me a chequebook balancing program.

Erm, tell me this isn't the first ever program you've written.

And yes getline() is a function in C++.
I know you've posted on the C forum, but I figured the assignment knew more than you did, and the intention was for you to use C++.

If that's not the case (and it's really C), then you need to write your own (hint: use fgets).
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Jan 27th, 2009
0

Re: Give me a chequebook balancing program.

There you go, a program to print a balanced checkbook
  1. #include <stdio.h>
  2. int main ( ) {
  3. printf(
  4. "CHECKBOOK\n"
  5. "=========\n"
  6. " ^\n"
  7. );
  8. return 0;
  9. }
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Jan 28th, 2009
1

Re: Give me a chequebook balancing program.

Click to Expand / Collapse  Quote originally posted by Salem ...
There you go, a program to print a balanced checkbook
Well I learnt something from this thread

  1. printf(
  2. "CHECKBOOK\n"
  3. "=========\n"
  4. " ^\n"
  5. );
Had no idea you could do that in C.
Reputation Points: 49
Solved Threads: 1
Posting Whiz
riahc3 is online now Online
305 posts
since May 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: sscanf read error
Next Thread in C Forum Timeline: strings





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC