Output in the text file

Reply

Join Date: Jul 2004
Posts: 5
Reputation: KSGuan is an unknown quantity at this point 
Solved Threads: 0
KSGuan KSGuan is offline Offline
Newbie Poster

Output in the text file

 
0
  #1
Jul 23rd, 2004
Hello,
I'm just a beginner (student). Now still undergo C programming class to upgrade my knowledge in C. I was asked to complete a simple program to get the output of C program in the text file as shown below. This program is to help user to consider a range of interest rates for bank loan over 10,20,30 years. Prior to get this output the user is asked to enter the amount loan and a minimum & maximum interest rate. The output has to be in the form of text file as below.

Eg. Loan Amount : xxxxxx

Interest Rate Duration Monthly Payment Total Payment
xxxxx xxxx xxxxxxxx xxxxxxxx

I'm thinking to use the following formula for calculating the monthly payment & transfer the result to "Monthly payment column" above. However, I have no idea what to do first & how to go about to get this result printed in the text file. Can I use this math equation---> payment = i*p/1-pow(1+i,-n).

Anyone has a similar program that I can use or study in order for me to get start. Your assistance is highly appreciated.

Rgds,
GKS

( Note : Formula for mthly payment = ip/1-(1+i)-n ).
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 436
Reputation: Chainsaw is an unknown quantity at this point 
Solved Threads: 11
Chainsaw's Avatar
Chainsaw Chainsaw is offline Offline
Unprevaricator

Re: Output in the text file

 
0
  #2
Jul 24th, 2004
Well, printf() will print to 'standard out' which can be directed to a text file.

fprintf() is what you want, though. fopen() opens the file, fprintf() writes text to it, and fclose() will close it.

If you look up those routines you'll have all that you need.

Good luck!
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 256
Reputation: FireNet will become famous soon enough FireNet will become famous soon enough 
Solved Threads: 6
FireNet's Avatar
FireNet FireNet is offline Offline
Posting Whiz in Training

Re: Output in the text file

 
0
  #3
Jul 24th, 2004
If you want a tut on fstream look in the tutorial fourm
See what you can, remember what you need

Fourzon | Earn via Coding
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 5
Reputation: KSGuan is an unknown quantity at this point 
Solved Threads: 0
KSGuan KSGuan is offline Offline
Newbie Poster

Re: Output in the text file

 
0
  #4
Jul 24th, 2004
Hi Chainsaw,

Thanks for your reply. I'll try to it again.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC