Groups | Search | Server Info | Login | Register
Groups > comp.os.ms-windows.programmer.misc > #17
| Newsgroups | comp.os.ms-windows.programmer.misc |
|---|---|
| Date | 2012-10-01 23:04 -0700 |
| References | <V8HO2.56728$Eb.10686@nnrp2.clara.net> |
| Message-ID | <bde4c4f8-bcc0-4f97-9538-fdabeb097130@googlegroups.com> (permalink) |
| Subject | Re: C Programming under Windows |
| From | adityaismagic@gmail.com |
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_____________
include<stdio.h>
#include<conio.h>
#include<math.h>
#include<limits.h>
#include<float.h>
int main()
{
int op;
float maxflow, peakflow, set_velocity, s_gravity, p_diameter, temp;
float h_velocity, width, depth, length, d_time;
float c_area;
printf("\n Enter Maximum/Peak flow (in Mld) : "); //Mld=million liter per dad//
//let assume 20 Mld//
scanf("%f",&maxflow);
peakflow = (maxflow*pow(10,6))/(24*60*60*1000); //converting Mld into cu.m/sec//
printf("\n : %f cu.m/sec",peakflow);//it will be 0.2314 cu.m/sec//
printf("\n\n do you want to provide settling velocity");
printf("\n 1> yes\n 2> no");
printf("\n\n Enter your choise : ");
scanf("%d",&op);
switch(op)
{
case 1: printf("\n Enter Settling velocity (in m/sec) : ");//assume 0.02//
scanf("%f",&set_velocity);
break;
case 2: printf("\n Enter Specific velocity of particle : ");//assume 2.65//
scanf("%f",&s_gravity);
printf("\n Enter diameter of particle(in mm) : ");//assume 0.2//
scanf("%f",&p_diameter);
printf("\n Enter atmospheric temperature(in degree celcius) : ");//assume 20//
scanf("%f",&temp);
set_velocity = 60.6*(p_diameter/10)*(s_gravity-1)*((3*temp+70)/100);
printf("\n Settling velocity is : %f cm/sec",set_velocity);//it will be 2.5997 cm/sec//
printf("\n : %f m/sec",set_velocity/100);//it will be 0.02599 m/sec//
break;
}
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 //
printf("\n Cross Sectional area : %f sq.m",c_area);
printf("\n\n Which of following parameter you can provide");
printf("\n 1>Width \n 2>Depth");
printf("\n Enter your choise : ");
scanf("%d",&op);
switch(op)
{
case 1: printf("\n Enter Width (in meter) : ");
scanf("%f",&width);
depth = c_area/width;
printf("\n Depth : %f m",depth);
break;
case 2: printf("\n Enter Depth (in meter) : ");
scanf("%f",&depth);
width = c_area/depth;
printf("\n Width : %f m",width);
break;
}
d_time = depth/set_velocity;
printf("\n\n Detention time : %f sec",d_time);
length = h_velocity * d_time;
printf("\n\n Length : %f m",length);
printf("\n Width : %f m",width);
printf("\n Depth : %f m",depth);
return(0);
}
Back to comp.os.ms-windows.programmer.misc | Previous | Next — 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