#include<stdio.h>
void print_list(void){
printf("%15s%15s%15s%15ds\n",
"GasType","Gas","a(L^2-atm/mol^2)", "b(L/mol)");
printf("%15s%15s%15s%15ds\n",
"1","Heleium,He","0.0341", "0.0237");
printf("%15s%15s%15s%15ds\n",
"2","Hydrogen,H2","0.244", "0.0266");
printf("%15s%15s%15s%15ds\n", "3","Oxygen,O2","1.36",
"0.0318");
printf("%15s%15s%15s%15ds\n",
"4","Chlorine,Cl2","6.49", "0.0562");
printf("%15s%15s%15s%15ds\n", "5","Carbon
dioxide,CO2","3.59", "0.0427");
}
double presure_cal(int gas_type, double T, double V, double
n){
double a[5];
double b[5];
double value;
a[0] = 0.0341;
a[1] = 0.244;
a[2] = 1.36;
a[3] = 6.49;
a[4] = 3.59;
b[0] = 0.0237;
b[1] = 0.0266;
b[2] = 0.0318;
b[3] = 0.0562;
b[4] = 0.0427;
value = (0.08206 * T)/((V/n)-b[gas_type-1]) -
a[gas_type-1]/((V/n)*(V/n));
return value;
}
int main(){
char c;
double a[5];
double b[5];
int n;
double qty;
double temp;
double ivol;
double fvol;
double incr;
do {
printf("%-30s %-30s\n","Number","Gas
Type");
printf("%-30s %-30s\n","1","Helium");
printf("%-30s %-30s\n","2","Hydrogen");
printf("%-30s %-30s\n","3","Oxygen");
printf("%-30s %-30s\n","4","Chlorine");
printf("%-30s %-30s\n","5","Carbon
dioxide");
do {
printf("Enter Gas number(1,2,3,5 or 5)>>");
scanf("%d",&n);
} while (n <1 || n
>5);
printf("Enter Quantity of gas
(in moles)>>");
scanf("%lf",&qty);
printf("Enter temperature (in
Kelvin)>>");
scanf("%lf",&temp);
printf("Enter initial volume
(in liters)>>");
scanf("%lf",&ivol);
printf("Enter final volume (in
liters)>>");
scanf("%lf",&fvol);
printf("Enter volume
increment(in liters)>>");
scanf("%lf",&incr);
c = getchar();
printf("%-25s
%-25s\n","Volume(liters)","Presure(atm)");
while (ivol <=
fvol+incr){
printf("%-25lf %-25lf\n",ivol,presure_cal(n,temp,ivol,qty));
ivol = ivol + incr;
}
printf("Do you want to
continue(y or n)?");
c= getchar();
} while (c != 'n');
return 0;
}
I am writing a c code and using case switch statement for the gas type to...
I am writing a program in c programming and it is supposed to do the following using mc9s12dg256.h microcontroller When both DIP switches #8 and #1 are high, turn on all LEDS. When both DIP switches #8 and #1 are low, turn off all LEDs When DIP switch #8 is high and #1 is low, turn on all the even numbered LEDs. When DIP switch #1 is high and #8 is low, turn on all the odd numbered LEDs. Your...
I am writing a program in C++, which requires me to read an input text file using command line argument. However, I am using xcode on my Macbook to write C++ program, and use terminal instead of command. How do you use int main(int argc, char** argv[]) to read an input file. My professor requires us not to hard code the text file name like .open("example.txt"); Thank you!
I need help writing a C programming code. I am trying to create a program that returns ANY given number's decimal value as an Integer (Whole number). Examples: User input: 0.35 Output: 35 User input: 1.465 Output: 465 User input: 10.6054 Output: 6054
Hi I need some help writing a security code using python mongodb restful api. I just need help on how to provide a security login to user to enter their username and password or to have a block in using extra access once they have logined and they want more access to the databases they will be force to sign out of the server but I just do not know how to start on it can someone show me how...
I want c++ code for employee payslip calculation using switch statement convert this code to switch statement also, use for loop ___________________________________________________________________________ #include using namespace std; int main() {char empname[222]; float basicSalary, h_r_a, DearnessAllow, tax, netSalary; int e_id; cout<<"\nEmployee Name :"; cin>>empname; cout<<"\nEmployee Id :"; cin>>e_id; cout << "Enter Basic Salary : "; cin >> basicSalary; DearnessAllow = 0.30 * basicSalary; h_r_a= 800; tax = 0.10 * basicSalary; netSalary = basicSalary + DearnessAllow + h_r_a - tax; cout<<"\nEmployee Id :...
I am writing python code. I submitted an assignment but the professor said it was a modularization. Can you help me see what part of the code is modularization? Pseudocode: 1. Decalre MainMethod () function: # A. Parameters: Three numbers # B. Put the three numbers in reverse # 2. Main Program # A. Initialize Varibles # B. Accepts three values from the user # C. Invoke MainMethod () function, passing the three numbers as arguments in reverse # D....
I am writing chemical formulas using elements and I have to name them. I am getting confused as to when to use the prefix because sometimes they are omitted. For example if given N^4+ O when you name it it becomes NO2 (nitrogen dioxide ) where did the number 4 go and why did O gain a number 2
How would this switch statement be modified to not use "continue"? This piece of code is part of a larger assignment and that assignment prohibits the use of "continue" for switch statements. How do I modify this code so that it still does what I want it to do, without using "continue"? while (true) { choice = displayMenu(keyboard); switch (choice) { case 'D': case 'd': { courseStudents.displayStudentList(); continue; } case 'A': case 'a': { int id; double stGpa; System.out.println("Enter...
i need help writing this in C code Give a memory snapshot after each statement is executed, assuming that x is equal to 2 and that y is equal to 4 before the statement is executed. Also, assume that all the variables are integers. z = x++*y; x += y; z = ++x*y; y %= x;
Urgent Help!!! I am writing a case study related to the use of Artificial Intelligence (AI) in the construction sector. Companies which produce concrete mix ( LafargeHolcim, HeidelbergCement and etc), how they implement AI in their company and work? I am facing some difficulties in research. I would appreciate if any of you would help me to find 3 companies which use AI in there work.