aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Nayema Ferdoushi <134846919+NAYEMA26@users.noreply.github.com>2024-03-10 22:07:54 +0600
committerLibravatar GitHub <noreply@github.com>2024-03-10 22:07:54 +0600
commit9ac9f0c1a5ac470315b57057745cb8afd1467eee (patch)
tree7955c77fe67306b095dd093c957c93d55dc335dc
parenta2d29e8b76d3969e7c5f4f4509abf92727585a1b (diff)
downloadentropy-calc-9ac9f0c1a5ac470315b57057745cb8afd1467eee.tar.gz
entropy-calc-9ac9f0c1a5ac470315b57057745cb8afd1467eee.zip
Update main.cpp
-rw-r--r--main.cpp65
1 files changed, 34 insertions, 31 deletions
diff --git a/main.cpp b/main.cpp
index 9b78f4f..0372acd 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,44 +1,47 @@
-#include <iostream>
-#include <vector>
-#include "headers/allElements.h"
-#include "headers/baseElement.h"
-
-using namespace std;
-
-int main()
-{
- vector<baseElement*> 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): ";
+#include <iostream>
+#include <vector>
+#include "headers/allElements.h"
+#include "headers/baseElement.h"
+
+using namespace std;
+
+int main()
+{
+ vector<baseElement*> 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;
if (mass <= 0)
{
cout << "Mass must be a positive value" << endl;
return 0;
- }
- cout << "Enter the initial temperature of the element (in K): ";
- cin >> fromTemp;
- cout << "Enter the final temperature of the element (in K): ";
+ }
+ cout << "Enter the initial temperature of the element (in K): ";
+ cin >> fromTemp;
+ cout << "Enter the final temperature of the element (in K): ";
cin >> toTemp;
if (fromTemp > toTemp)
{
cout << "Initial temperature can not be greater than final temperature" << endl;
return 0;
- }
+ }
double totalHeat = elements[choice - 1]->totalHeatNeeded(mass, fromTemp, toTemp);
- double totalEntropy = elements[choice - 1]->totalEntropyChange(mass, fromTemp, toTemp);
- cout << "The total heat needed is: " << totalHeat << " J" << endl;
+ double totalEntropy = elements[choice - 1]->totalEntropyChange(mass, fromTemp, toTemp);
+ cout << "The total heat needed is: " << totalHeat << " J" << endl;
cout << "The total entropy change is: " << totalEntropy << " J/K" << endl;
- return 0;
-}
+ return 0;
+
+ //thank you.. feel free to contribute here..:)
+
+}