2024-02-28 16:11:37 -06:00
|
|
|
|
/*
|
|
|
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
|
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/cppFiles/main.cc to edit this template
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* File: main.cpp
|
|
|
|
|
* Author: caleb
|
|
|
|
|
*
|
|
|
|
|
* Created on February 26, 2024, 11:30 AM
|
|
|
|
|
*/
|
2024-03-01 09:38:35 -06:00
|
|
|
|
#include <iomanip>
|
2024-02-28 16:11:37 -06:00
|
|
|
|
#include <cstdlib>
|
2024-03-01 09:38:35 -06:00
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <tuple>
|
|
|
|
|
#include <cmath>
|
2024-02-28 16:11:37 -06:00
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2024-03-01 09:38:35 -06:00
|
|
|
|
int milesPerGallon(int gallons, int milesDriven) {
|
|
|
|
|
return milesDriven / gallons;
|
|
|
|
|
}
|
2024-02-28 16:11:37 -06:00
|
|
|
|
|
2024-03-01 09:38:35 -06:00
|
|
|
|
std::tuple<double, double> maleFemalePercentages(int maleStudents, int femaleStudents) {
|
|
|
|
|
int totalStudents = maleStudents + femaleStudents;
|
|
|
|
|
double malePercentage = (double) maleStudents / totalStudents;
|
|
|
|
|
double femalePercentage = (double) femaleStudents / totalStudents;
|
|
|
|
|
return {malePercentage, femalePercentage};
|
|
|
|
|
}
|
2024-02-28 16:11:37 -06:00
|
|
|
|
|
2024-03-01 09:38:35 -06:00
|
|
|
|
double celciusToFahrenheit(double celcius) {
|
|
|
|
|
return 9.0 / 5.0 * celcius + 32.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double monthlySalesTax(int month, int year, double total) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
|
cout << "The car that drove 375 miles and burned 15 gallons of gasoline consumed the fuel at a rate of " << milesPerGallon(15, 375) << " MPG.\n";
|
|
|
|
|
int maleStudents, femaleStudents = 0;
|
|
|
|
|
//double malePercentage, femalePercentage = 0.0;
|
|
|
|
|
cout << "Enter the number of male students, followed by the number of female students: ";
|
|
|
|
|
cin >> maleStudents >> femaleStudents;
|
|
|
|
|
auto [malePercentage, femalePercentage] = maleFemalePercentages(maleStudents, femaleStudents);
|
|
|
|
|
cout << "The ratio of male to female students is " << setprecision(2) << (malePercentage * 10) << "/" << setprecision(2) <<(femalePercentage * 10) << endl;
|
|
|
|
|
cout << "0C is " << std::to_string(celciusToFahrenheit(0)) << "F." << endl;
|
|
|
|
|
cout << "100C is " << std::to_string(celciusToFahrenheit(100)) << "F." << endl;
|
|
|
|
|
cout << "23.8889C is " << std::to_string(celciusToFahrenheit(23.8889)) << "F." << endl;
|
|
|
|
|
|
|
|
|
|
|
2024-02-28 16:11:37 -06:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|