Groups | Search | Server Info | Login | Register
Groups > comp.os.ms-windows.programmer.misc > #18
| From | r_z_aret@pen_fact.com |
|---|---|
| Newsgroups | comp.os.ms-windows.programmer.misc |
| Subject | Re: C Programming under Windows |
| Date | 2012-10-02 11:43 -0400 |
| Organization | The World : www.TheWorld.com : Since 1989 |
| Message-ID | <sv1m68luvmfkmd1a6pkubh5nt4iods23ao@4ax.com> (permalink) |
| References | <V8HO2.56728$Eb.10686@nnrp2.clara.net> <bde4c4f8-bcc0-4f97-9538-fdabeb097130@googlegroups.com> |
On Mon, 1 Oct 2012 23:04:51 -0700 (PDT), adityaismagic@gmail.com
wrote:
>HELP ME, PLEASE...
>i am developing software for some frnds of civil engg. dept. topic - Hydraulic Design for Sewage waste-water treatment, Grit Chamber Designing. I wrote program but it gives floating point overflow error.
>In code c_area variable goes to float overflow. how to convert data type of c_area, (%2.4f) i.e. xx.xxxx.
>I tried to search on google for help but till no solution found.
>If you will find answer please email me, because i don't know how this google group works, my id adityaismagic@gmail.com , Thank You.
>my code is_____________
I very rarely use email to discuss problems raised in forums. Everyone
should be able to see and benefit from all the questions and answers,
unless they become unusually obscure.
>
> printf("\n\n Enter Horizontal velocity / Flow through velocity (in m/sec) : ");//assume 0.23 m/sec//
> scanf("%2.4f",h_velocity);
> c_area = peakflow/h_velocity;//overflow happens here, how to convert this value into %2.4f //
Overflow is very likely to happen when the denominator is small or
zero, so you should _always_ check denominator before division. And
you should always check that user input is at least reasonable.
Nothing in C is stored as %2.4f, except for numbers stored as
character strings. You can use printf to convert a float into a
character string, or just print it as you do. The printf function
takes formatting arguments similar to scanf.
> printf("\n Cross Sectional area : %f sq.m",c_area);
-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
Robert E. Zaret
PenFact, Inc.
20 Park Plaza, Suite 400
Boston, MA 02116
www.penfact.com
Useful reading (be sure to read its disclaimer first):
http://catb.org/~esr/faqs/smart-questions.html
Back to comp.os.ms-windows.programmer.misc | Previous | Next — Previous in thread | Next in thread | Find similar
Re: C Programming under Windows adityaismagic@gmail.com - 2012-10-01 23:04 -0700
Re: C Programming under Windows r_z_aret@pen_fact.com - 2012-10-02 11:43 -0400
Re: C Programming under Windows r_z_aret@pen_fact.com - 2012-10-02 12:47 -0400
csiph-web