C++ code for
Determining the Depth of Flow for Most economical Rectangular Section
#include <iostream>
#include <math.h>
using namespace std;
int main() {
float Q,S,c,b,y,a,r,t1,t2,t3;
cout<<"Enter Discharge:" <<endl;
cin>>Q;
cout<<"Enter bed slope:"<<endl;
cin>>S;
cout<<"Enter Chezy's constant :"<<endl;
cin>>c;
b=2; //in terms of y
a=2; //in terms of y^2
r=0.5; // in terms of y
t3=r*S;
float t4=sqrtf(t3);
cout<<t3;
float t5=a*c*t4; //y ^ 2.5
t1=Q/t5; //in terms of y raised to 5/2
cout<<"\n"<<t1;
t3=t1*t1;
y=powf(t3,0.2);
cout<<endl<<"Value of y "<<y;
t3=b*y;
cout<<endl<<"Value of b "<<t3;
return 0;
}