Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- /*
- Litet program som kalkylerar den begränsande reaktanten av två ämnnen utifrån
- förhållandet och mängden i mol.
- */
- double ratio_component_chemical_one;
- double ratio_component_chemical_two;
- cout << "Type in the ratio between the two chemicals: ";
- cin >> ratio_component_chemical_one;
- cout << ":";
- cin >> ratio_component_chemical_two;
- //-----------------------------------------
- cout << "Now insert the amount of mole units you have of each chemical - " << endl;
- double number_of_moles_chemical_one;
- double number_of_moles_chemical_two;
- cout << "First chemical: " << endl;
- cin >> number_of_moles_chemical_one;
- cout << "Second chemical: " << endl;
- cin >> number_of_moles_chemical_two;
- //Uträkning
- double expected_ratio_component = ratio_component_chemical_two/ratio_component_chemical_one;
- if(number_of_moles_chemical_one * expected_ratio_component == number_of_moles_chemical_two)
- {
- cout << "There's no limiting chemical!" << endl;
- }
- else if(number_of_moles_chemical_one * expected_ratio_component > number_of_moles_chemical_two)
- {
- cout << "The second chemical is the limiting chemical!" << endl;
- }
- else if(number_of_moles_chemical_one * expected_ratio_component < number_of_moles_chemical_two)
- {
- cout << "The first chemical is the limiting chemical!" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement