diff options
author | 2024-03-07 01:39:41 +0600 | |
---|---|---|
committer | 2024-03-07 01:39:41 +0600 | |
commit | a8aa863d7e9732dc65f86bb3f4cbdd243e6ad6da (patch) | |
tree | d88c34054e8005358f98f4c81d1574ebeb39dd07 /main.cpp | |
download | entropy-calc-a8aa863d7e9732dc65f86bb3f4cbdd243e6ad6da.tar.gz entropy-calc-a8aa863d7e9732dc65f86bb3f4cbdd243e6ad6da.zip |
Add water element and entropy calculator project files
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..f9e2c38 --- /dev/null +++ b/main.cpp @@ -0,0 +1,30 @@ +#include <iostream> +#include <vector> +#include "headers/allElements.h" +#include "headers/genericElement.h" + +using namespace std; + +int main() +{ + vector<genericElement*> elements = getAllElements(); + cout << "Choose an element: " << endl; + for (int i = 0; i < elements.size(); i++) + { + cout << i + 1 << ". " << elements[i]->getElementName() << endl; + } + int choice; + cout << "Write the number of the element: "; + cin >> choice; + cout << endl << elements[choice - 1]->getElementName() << " Selected" << endl; + + double mass, fromTemp, toTemp; + cout << "Enter the mass of the element (in Kg): "; + cin >> mass; + cout << "Enter the initial temperature of the element (in K): "; + cin >> fromTemp; + cout << "Enter the final temperature of the element (in K): "; + cin >> toTemp; + + cout << "The total entropy change is: " << elements[choice - 1]->totalEntropyChange(mass, fromTemp, toTemp) << " J/K" << endl; +} |