Code:
#include "stdafx.h"
#include "Functions.h"
#include <iostream>
using namespace std;
double kg;
double lb;
double Functions::GetDouble(const std::string & prompt)
{
return 0;
}
int Functions::GetInt(const std::string & prompt)
{
return 0;
}
double Functions::ConvertCelsiusToKelvin(double c)
{
return 0.0;
}
double Functions::ConvertKgToLbs(double kg)
{
return 0.0;
}
double Functions::ConvertTspToMl(double tsp)
{
return 0.0;
}
void Functions::MulTable(int first, int last)
{
}
void Functions::SquareTable(int first, int last, unsigned int step)
{
}
int Functions::Menu()
{
double kg, lb;
kg = 50;
cout << "this will maybe convert kilograms to pounds.\n";
cout << "please enter weight in kilograms" ;
cin >> lb;
lb = kg * 2.2;
cout << "The weight in kilograms is: " << kg << '\n';
int opt;
do {
for (int i = 1; i <= 5; i++)
cout << "Function " << i << " [" << i << ']' << endl;
cout << "Quit [0]\nEnter Option: ";
cin >> opt;
} while (opt < 0 || opt > 5);
return opt;
}
Code:
#ifndef _FUNCTIONS_H_
#define _FUNCTIONS_H_
#include <iostream>
#include <string>
enum Options { NORMAL_EXIT, KG_TO_LBS, CELSIUS_TO_KELVIN, TSP_TO_ML, M_TABLE, S_TABLE };
class game
{
private:
protected:
public:
game();
virtual int Menu() = 0;
};
class Functions
{
public:
static double GetDouble(const std::string& prompt);
static int GetInt(const std::string& prompt);
static double ConvertCelsiusToKelvin(double c);
static double ConvertKgToLbs(double kg);
static double ConvertTspToMl(double tsp);
static void MulTable(int first, int last);
static void SquareTable(int first, int last, unsigned int step);
virtual int Menu();
};
#endif
Code:
#include "stdafx.h"
#include <iostream>
#include "Functions.h"
using namespace std;
int main()
{
int opt;
Functions *f = new Functions();
do {
opt = f->Menu();
switch (opt)
{
case 1:
f->ConvertKgToLbs(100); break;
case 2:
f->ConvertCelsiusToKelvin(100); break;
case 3:
f->ConvertTspToMl(100); break;
case 4:
f->MulTable(12, 12); break;
case 5:
f->SquareTable(1, 2, 3); break;
}
} while (opt != 0);
}