Learn Computer Programming Free from our source codes in my website.
Sponsored Link Please Support
https://www.techseries.dev/a/27966/qWm8FwLb
https://www.techseries.dev/a/19181/qWm8FwLb
My Personal Website is http://www.jakerpomperada.com
Email me at jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Saturday, May 25, 2024
Temperature Converter in C++ Using Object-Oriented Programming
#include <iostream>
#include <iomanip>
class TemperatureConverter {
public:
// Constructor
TemperatureConverter() {}
// Convert Celsius to Fahrenheit
double celsiusToFahrenheit(double celsius) {
return (celsius * 9.0 / 5.0) + 32;
}
// Convert Fahrenheit to Celsius
double fahrenheitToCelsius(double fahrenheit) {
return (fahrenheit - 32) * 5.0 / 9.0;
}
};
int main() {
TemperatureConverter converter;
char choice;
do {
std::cout << "\n\n\tTemperature Converter Main Menu\n" << std::endl;
std::cout << "\t[1] Celsius to Fahrenheit" << std::endl;
std::cout << "\t[2] Fahrenheit to Celsius" << std::endl;
std::cout << "\t[3] Quit Program" << std::endl;
std::cout << "\n\tEnter your choice: ";
std::cin >> choice;
if (choice == '1') {
double celsius;
std::cout << "\tEnter temperature in Celsius: ";
std::cin >> celsius;
double fahrenheit = converter.celsiusToFahrenheit(celsius);
std::cout << "\tTemperature in Fahrenheit: " <<std::fixed <<std::setprecision(2)<< fahrenheit << std::endl;
} else if (choice == '2') {
double fahrenheit;
std::cout << "\tEnter temperature in Fahrenheit: ";
std::cin >> fahrenheit;
double celsius = converter.fahrenheitToCelsius(fahrenheit);
std::cout << "\tTemperature in Celsius: " <<std::fixed <<std::setprecision(2)<< celsius << std::endl;
} else if (choice != '3') {
std::cout << "\n\tInvalid choice. Please try again." << std::endl;
}
} while (choice != '3');
std::cout << "\n\tEnd of Program. Thank you for using this program." << std::endl;
return 0;
}
Friday, May 24, 2024
Thursday, May 23, 2024
Wednesday, May 22, 2024
Monday, May 20, 2024
What is Mechatronics?
What is Mechatronics?
Mechatronics is a multidisciplinary field that refers to the skill sets needed in the contemporary, advanced automated manufacturing industry. At the intersection of mechanics, electronics, and computing, mechatronics specialists create simpler, smarter systems.
Saturday, May 18, 2024
Friday, May 17, 2024
Thursday, May 16, 2024
Wednesday, May 15, 2024
Tuesday, May 14, 2024
Monday, May 13, 2024
What is Robotics?
What is Robotics?
In simple terms, robotics combines science, engineering, and technology to design, construct, operate, and use machines programmed to replicate, substitute, or assist humans in completing tasks of varying complexity. These machines are known as robots.