From 8808dbe579cb4a935e32b3abfb2de81cf796e977 Mon Sep 17 00:00:00 2001 From: Mubashshir Date: Tue, 12 Mar 2024 13:36:33 +0600 Subject: linux: Convert CRLF to LF only Signed-off-by: Mubashshir --- main.cpp | 91 +++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 44 insertions(+), 47 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 0372acd..a60839a 100644 --- a/main.cpp +++ b/main.cpp @@ -1,47 +1,44 @@ -#include -#include -#include "headers/allElements.h" -#include "headers/baseElement.h" - -using namespace std; - -int main() -{ - vector 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): "; - 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; - cout << "The total entropy change is: " << totalEntropy << " J/K" << endl; - return 0; - - //thank you.. feel free to contribute here..:) - -} +#include +#include +#include "headers/allElements.h" +#include "headers/baseElement.h" + +using namespace std; + +int main() +{ + vector 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): "; + 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; + cout << "The total entropy change is: " << totalEntropy << " J/K" << endl; + return 0; + + //thank you.. feel free to contribute here..:) + +} -- cgit v1.2.3