Question

#include <iostream> #include<cmath> using namespace std; int main() { float R = 8.314; // ideal gas...

#include <iostream>
#include<cmath>
using namespace std;

int main()
{
float R = 8.314; // ideal gas constant in J/(mole-K)
float F = 81;
float C = (F-32)*5/9;
float T = C + 273;
cout << " 70 degree F = " << T << endl;
  
double P = 13600*(30*2.54/1000)*9.81; // P density*g*h
cout << " P : " << P << " Pascal " << '\n';
  
double V = 10*10*5; // volume in m^3
double k_B = 1.38E-23; // Boltzmann Constant
double N = P*V/(k_B*T);
cout << " # of gas molecules : " << N << "\n";
float n = N*k_B/R;
  
cout << " # of moles here : " << n << 'n';
  
float m = 28*1.6E-27; // N_2 is 28 atomic mass unit
float Nm = N*m;
  
cout << " Total mass of gas molecules : " << Nm << " kg " << '\n';
  
double v_rms = sqrt(3*k_B*T/m);
cout << " Average speed of N2 : " << v_rms << '\n'; // in m/s
  
float v_rms_MPH = (v_rms*3600/(2.54*1000));
cout << " in MPH v_rms : " << v_rms_MPH << '\n';

// Write a program to obtain v_rms at 100F

// Calculate v_rms for T = Highest Temp recorded in Manhattan in last 5 yers
// as for example could be 100 F

please us C++ TO PROGRAMING

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Just modified from provided code

Code prompts user to enter Temperature in Fahrenheit then Calculate v_rms

If any modifications needed use comment section

#include <iostream>
#include<cmath>
using namespace std;

int main()
{
float R = 8.314; // ideal gas constant in J/(mole-K)
float F;
cout<<"Enter Temperature in Fahrenheit: ";
cin>>F;
float C = (F-32)*5/9;
float T = C + 273;
cout <<" "<< F<<" degree F = " << T << endl;

double P = 13600*(30*2.54/1000)*9.81; // P density*g*h
cout << " P : " << P << " Pascal " << '\n';

double V = 10*10*5; // volume in m^3
double k_B = 1.38E-23; // Boltzmann Constant
double N = P*V/(k_B*T);
cout << " # of gas molecules : " << N << "\n";
float n = N*k_B/R;

cout << " # of moles here : " << n << 'n';

float m = 28*1.6E-27; // N_2 is 28 atomic mass unit
float Nm = N*m;

cout << " Total mass of gas molecules : " << Nm << " kg " << '\n';

double v_rms = sqrt(3*k_B*T/m);
cout << " Average speed of N2 : " << v_rms << '\n'; // in m/s

float v_rms_MPH = (v_rms*3600/(2.54*1000));
cout << " in MPH v_rms : " << v_rms_MPH << '\n';
}

Add a comment
Know the answer?
Add Answer to:
#include <iostream> #include<cmath> using namespace std; int main() { float R = 8.314; // ideal gas...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Program 2 #include <iostream> #include <cmath> using namespace std; int main() {        const double PI...

    Program 2 #include <iostream> #include <cmath> using namespace std; int main() {        const double PI = 3.141592653;        int degrees;        double radians;        cout << "Enter a value for the degree of an angle\n";        cin >> degrees;        // translate the formula for converting degrees to radians into C++:        //            // degrees x PI        // ------------   = radians        //     180        radians = _____________________________________;        // Refer to p. 127 for help below....

  • Flow chart of this program #include <iostream> #include <cmath> using namespace std; int mainO double sum=0.0,...

    Flow chart of this program #include <iostream> #include <cmath> using namespace std; int mainO double sum=0.0, ave-ee, int locmx, locmn int n; cout <<"Enter the number of students: "<<endl; cin >> ni double listln]; double max-0; double min-e; for (int i-e ; i<n ;i++) cout<s enter the gpa: "<cendli cin>>listli]; while (listlile i listli1>4) cout<s error,Try again "<cendl; cin>listlil: sun+=list[i]; N1 if (listli]>max) for(int isin itt) max=list [i]; 10cmx=1+1 ; else if (list [i] min) min=list [i]; locmn-i+1; ave sum/n;...

  • Fix the following program (C++). #include <iostream> #include <cmath> #include <vector> #include <limits> using namespace std;...

    Fix the following program (C++). #include <iostream> #include <cmath> #include <vector> #include <limits> using namespace std; /* * Calculate the square of a number */ float square (float x) { return x*x; } /* * Calculate the average from a list of floating point numbers */ float average(vector<float>& values) { float sum = 0.0f; float average; for (float x : values) sum += x; average = sum / values.size(); return average; } /** Calculate the standard deviation from a vector...

  • #include <iostream> #include <cmath> #include <iomanip> #include <cstdlib> using namespace std; bool isInt (double value) {...

    #include <iostream> #include <cmath> #include <iomanip> #include <cstdlib> using namespace std; bool isInt (double value) {     double dummy;     return bool(modf(value, &dummy) == 0); } double sqr(double value) { return value * value; } double calcFrictionFactor(double R, double D, double epsilon) {     const double BlasiusCoefficient = 0.3164;     double f_old, f_new;     f_new = BlasiusCoefficient * pow(R, -0.25); // loop until our two values are within 0.000001 of each other     do {   f_old = f_new; // previous guess is now the old one...

  • what is the output for the following code? explain the steps. /*#include <iostream> using namespace std;...

    what is the output for the following code? explain the steps. /*#include <iostream> using namespace std; int f(int &i) { i = 10; return(5 * i); } int main() { int n = 5; f(n); cout << n << "\n"; return 0; } #include <iostream> using namespace std; int sub1(int n) { n--; return n; } int main() { int m = 10; for(int j = 0; j < 10; j++) m -= sub1(j); cout << m << "\n"; return...

  • #include <iostream> #include <math.h> using namespace std; float f1(int low,int up) { int i,total=0.0; for(i=low;i<=up;i++) {...

    #include <iostream> #include <math.h> using namespace std; float f1(int low,int up) { int i,total=0.0; for(i=low;i<=up;i++) { total=total+(i*i+i*1.5+4); } return total; } float f2(int low,int up) { int i,total=0.0; for(i=low;i<=up;i++) { total=total+(i*i+i*1.5-4); } return total; } int main() { int low,up; cout << "This program calculates the area under a curve between two points on the x axis\n"; cout<< "\nThe FIRST equation is: f(x)=x^2 +1.5x +4"; cout<< "\nThe SECOND equation is: f(x)=x^2 +1.5x -4"; cout << "\nEnter x's minimum value :...

  • Use this code to create multiple functions. #include<iostream> #include<iomanip> #include<fstream> using namespace std; int main() {...

    Use this code to create multiple functions. #include<iostream> #include<iomanip> #include<fstream> using namespace std; int main() { cout << fixed << showpoint << setprecision(2); ofstream outFile; outFile.open("Feras's.txt"); outFile << "..Skinny Feras's Restaurant ..\n\n" << endl; int choise=10, quantity; float paid, SubTotal=0, Tax = .10, Total, RM, more; while(choise!=0) { system("cls"); cout << "\t**Welcome To Skinny Alsaif Restaurant Lol**" << endl; cout << "\nWhat would you like to have?" << endl; cout << "1. Burger." << endl; cout << "2. Pizza." <<...

  • How do can I update this code (Code A): Code (A) #include using namespace std; int fibonacci(int n) { int a = 0,...

    How do can I update this code (Code A): Code (A) #include using namespace std; int fibonacci(int n) { int a = 0, b = 1, c; if (n <= 1) return n; for (int i = 2; i <= n; i++) { c = a + b; a = b; b = c; } return b; } int fibonacciRecursive(int n) { if (n <= 1) { return n; } return fibonacciRecursive(n-1) + fibonacciRecursive(n-2); } int main() { int n;...

  • #include #include #include #include #include #include #include using namespace std; const int MAX = 26; string...

    #include #include #include #include #include #include #include using namespace std; const int MAX = 26; string addRandomString(int n) {    char alphabet[MAX] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g',    'h', 'i', 'j', 'k', 'l', 'm', 'n',    'o', 'p', 'q', 'r', 's', 't', 'u',    'v', 'w', 'x', 'y', 'z' };    string res = "";    for (int i = 0; i < n; i++)    res = res + alphabet[rand() % MAX];    return res;...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT