Untitled
unknown
c_cpp
4 years ago
1.2 kB
8
Indexable
#include <iostream>
#include <string>
#include <vector>
#include <stdbool.h>
#include <stdio.h>
#include "graphic.h"
using namespace std;
class ConSingleton
{
public:
static ConSingleton& Get()
{
return cS_instance;
}
void converter(float kg)
{
cout << "Oto przekonwertrowana miara kg na funty: " << kg*pound;
}
private:
ConSingleton(){};
static ConSingleton cS_instance;
const float pound = 2.2046;
};
ConSingleton ConSingleton::cS_instance;
int main()
{
ConSingleton& instance = ConSingleton::Get();
bool exit = true;
int choice;
float user_weight;
choice = showMenu();
while (exit == true)
{
switch (choice)
{
case 1:
cout << "Wprowadz liczbe kg do kowersji na funty: ";
cin >> user_weight;
instance.converter(user_weight);
systemPause();
choice = showMenu();
break;
case -1:
exit = false;
break;
default:
cout << "WYKRYTO BLAD";
systemPause();
choice = showMenu();
break;
}
}
return 0;
}
Editor is loading...