aboutsummaryrefslogtreecommitdiff
path: root/headers
diff options
context:
space:
mode:
authorLibravatar Mubashshir <ahmubashshir@gmail.com>2024-03-12 13:36:33 +0600
committerLibravatar Mubashshir <ahmubashshir@gmail.com>2024-03-12 13:36:33 +0600
commit8808dbe579cb4a935e32b3abfb2de81cf796e977 (patch)
tree54d9d169c6bed8c5e688c77d14de269ab5c93693 /headers
parentb5590275651c8d0f80be7c698491725e7382b330 (diff)
downloadentropy-calc-8808dbe579cb4a935e32b3abfb2de81cf796e977.tar.gz
entropy-calc-8808dbe579cb4a935e32b3abfb2de81cf796e977.zip
linux: Convert CRLF to LF only
Signed-off-by: Mubashshir <ahmubashshir@gmail.com>
Diffstat (limited to 'headers')
-rw-r--r--headers/baseElement.h118
1 files changed, 59 insertions, 59 deletions
diff --git a/headers/baseElement.h b/headers/baseElement.h
index a3907fe..160d4b1 100644
--- a/headers/baseElement.h
+++ b/headers/baseElement.h
@@ -16,8 +16,8 @@ private:
double specificHeatLiquid;
double specificHeatGas;
double meltingPoint;
- double boilingPoint;
- string initialState = "";
+ double boilingPoint;
+ string initialState = "";
string finalState = "";
protected:
@@ -101,63 +101,63 @@ public:
double totalEntropyChange(double mass, double fromTemp, double toTemp)
{
- if (fromTemp < 0 || toTemp < 0)
- {
- cout << "Temperature cannot be less than 0 K" << endl;
- return 0;
- }
-
- double totalEntropy = 0;
- string initialState = "";
- string finalState = "";
- if (fromTemp == meltingPoint || fromTemp == boilingPoint)
- {
- cout << "What is the state of the element at the initial temperature?" << endl;
- if (initialState != "")
- initialState = readElementState();
- }
- if (toTemp == meltingPoint || toTemp == boilingPoint)
- {
- cout << "What is the state of the element at the final temperature?" << endl;
- if (finalState != "")
- finalState = readElementState();
- }
-
- if (toTemp <= meltingPoint)
- {
- totalEntropy += mass * specificHeatSolid * log(toTemp / fromTemp);
- if (toTemp == meltingPoint && finalState != "Solid")
- totalEntropy += mass * latentHeatOfFusion / meltingPoint;
- }
- else if (toTemp <= boilingPoint)
- {
- if (fromTemp < meltingPoint)
- totalEntropy += mass * specificHeatSolid * log(meltingPoint / fromTemp);
- if (fromTemp == meltingPoint && initialState != "Liquid")
- totalEntropy += mass * latentHeatOfFusion / meltingPoint;
- if (fromTemp <= meltingPoint)
- totalEntropy += mass * specificHeatLiquid * log(toTemp / meltingPoint);
- else
- totalEntropy += mass * specificHeatLiquid * log(toTemp / fromTemp);
- if (toTemp == boilingPoint && finalState != "Liquid")
- totalEntropy += mass * latentHeatOfVaporization / boilingPoint;
- }
- else
- {
- if (fromTemp < meltingPoint)
- totalEntropy += mass * specificHeatSolid * log(meltingPoint / fromTemp);
- if (fromTemp == meltingPoint && initialState != "Liquid")
- totalEntropy += mass * latentHeatOfFusion / meltingPoint;
-
- if (fromTemp < boilingPoint)
- totalEntropy += mass * specificHeatLiquid * log(fromTemp / meltingPoint);
- if (fromTemp == boilingPoint && initialState != "Gas")
- totalEntropy += mass * latentHeatOfVaporization / boilingPoint;
-
- if (fromTemp > boilingPoint)
- totalEntropy += mass * specificHeatGas * log(toTemp / fromTemp);
- else
- totalEntropy += mass * specificHeatGas * log(toTemp / boilingPoint);
+ if (fromTemp < 0 || toTemp < 0)
+ {
+ cout << "Temperature cannot be less than 0 K" << endl;
+ return 0;
+ }
+
+ double totalEntropy = 0;
+ string initialState = "";
+ string finalState = "";
+ if (fromTemp == meltingPoint || fromTemp == boilingPoint)
+ {
+ cout << "What is the state of the element at the initial temperature?" << endl;
+ if (initialState != "")
+ initialState = readElementState();
+ }
+ if (toTemp == meltingPoint || toTemp == boilingPoint)
+ {
+ cout << "What is the state of the element at the final temperature?" << endl;
+ if (finalState != "")
+ finalState = readElementState();
+ }
+
+ if (toTemp <= meltingPoint)
+ {
+ totalEntropy += mass * specificHeatSolid * log(toTemp / fromTemp);
+ if (toTemp == meltingPoint && finalState != "Solid")
+ totalEntropy += mass * latentHeatOfFusion / meltingPoint;
+ }
+ else if (toTemp <= boilingPoint)
+ {
+ if (fromTemp < meltingPoint)
+ totalEntropy += mass * specificHeatSolid * log(meltingPoint / fromTemp);
+ if (fromTemp == meltingPoint && initialState != "Liquid")
+ totalEntropy += mass * latentHeatOfFusion / meltingPoint;
+ if (fromTemp <= meltingPoint)
+ totalEntropy += mass * specificHeatLiquid * log(toTemp / meltingPoint);
+ else
+ totalEntropy += mass * specificHeatLiquid * log(toTemp / fromTemp);
+ if (toTemp == boilingPoint && finalState != "Liquid")
+ totalEntropy += mass * latentHeatOfVaporization / boilingPoint;
+ }
+ else
+ {
+ if (fromTemp < meltingPoint)
+ totalEntropy += mass * specificHeatSolid * log(meltingPoint / fromTemp);
+ if (fromTemp == meltingPoint && initialState != "Liquid")
+ totalEntropy += mass * latentHeatOfFusion / meltingPoint;
+
+ if (fromTemp < boilingPoint)
+ totalEntropy += mass * specificHeatLiquid * log(fromTemp / meltingPoint);
+ if (fromTemp == boilingPoint && initialState != "Gas")
+ totalEntropy += mass * latentHeatOfVaporization / boilingPoint;
+
+ if (fromTemp > boilingPoint)
+ totalEntropy += mass * specificHeatGas * log(toTemp / fromTemp);
+ else
+ totalEntropy += mass * specificHeatGas * log(toTemp / boilingPoint);
}
return totalEntropy;
}