-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4_namespace.cpp
43 lines (34 loc) · 1.13 KB
/
4_namespace.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* Trying namespace, by commenting namespace library and using namespace manually in every line with "std::"
written by Tariq Ridwan: 👉 https://tariqridwan.github.io/
Universitat Politècnica de Catalunya, Barcelona */
#include<iostream>
#include<string>
// #include<cmath>
// using namespace std; //
double Reynolds(double rho, double U, double mu, double D);
int main()
{
double U, rho, mu, D, Re;
std::string write_intro;
write_intro = "Calculating Reynolds number\n";
std::cout << write_intro;
std::cout << "What is the velocity in (m/s)?" << std::endl;
std::cin >> U;
std::cout << "What is density in (kg/m3)?\n";
std::cin >> rho;
std::cout << "What is the dynamic viscosity?" << std::endl;
std::cin >> mu;
std::cout << "What is the characteristic length (m)?" << std::endl;
std::cin >> D;
// calculate
std::cout << "So the Reynolds number is:" << std::endl;
Re = Reynolds(rho,U,mu,D);
std::cout << Re << std::endl;
return 0;
}
double Reynolds(double rho, double U, double mu, double D)
{
int result; // int or double
result = rho*U*D/mu;
return result;
}