| | |
Give me a chequebook balancing program.
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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.
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.
> 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
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
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.
Search for your answer first!; the first point from Read This Before Posting, at the head of the forum.
"If it moves, tax it. If it keeps moving, regulate it, and if it stops moving, subsidize it" - Ronald Reagan
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).
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).
There you go, a program to print a balanced checkbook
C Syntax (Toggle Plain Text)
#include <stdio.h> int main ( ) { printf( "CHECKBOOK\n" "=========\n" " ^\n" ); return 0; }
•
•
Join Date: May 2008
Posts: 82
Reputation:
Solved Threads: 0
Well I learnt something from this thread
Had no idea you could do that in C.
c Syntax (Toggle Plain Text)
printf( "CHECKBOOK\n" "=========\n" " ^\n" );
![]() |
Other Threads in the C Forum
- Previous Thread: sscanf read error
- Next Thread: strings
| Thread Tools | Search this Thread |
Tag cloud for C
adobe ansi api array arrays asterisks binarysearch calculate centimeter char convert copyanyfile copyimagefile copypdffile cprogramme createcopyoffile csyntax directory drawing dynamic executable fflush file fork frequency getlasterror givemetehcodez graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators infiniteloop initialization interest km lazy linked linkedlist linux linuxsegmentationfault list locate logical_drives match matrix microsoft motherboard multi mysql number open opendocumentformat opensource owf pattern pdf performance pointer pointers posix power problem probleminc program programming pyramidusingturboccodes read recursion recv repetition scanf scheduling scripting segmentationfault send shape socketprograming spoonfeeding stack standard string strings structures student suggestions systemcall test testautomation unix user variable voidmain() wab win32api windows.h






