@enedil: okej, teraz rozumiem, to jakim sposobem wprowadzić te dane w program? — WiszuLIVEE 10 sekund temu
#include <functional>
#include <array>
#include <iostream>
using namespace std;
int main()
{
int wybor;
cin >> wybor;
if (wybor == 1) {
array<function<double(int*, int*, int*)>, 2> ppm
{
[](int* age,int* height,int* weight) { return 10.0 * *weight + 6.25 * *age + 5; },
[](int* age,int* height,int* weight) { return 10.0 * *weight + 6.25 * *age - 161; }
};
int age, height, weight;
cin >> age >> height >> weight;
char sex;
cin >> ws >> sex;
bool isfemale = (tolower(sex) == 'k');
cout << "ppm=" << ppm[isfemale](&age, &height, &weight) << endl;
return 0;
}
else if(wybor==2){
array<function<double(int*, int*, int*)>, 1> icm; {
[]( int* weight) { return 50 + 0.9 * (*weight - 152); };
[]( int* weight) { return 45.5 + 0.9 * (*weight - 152); };
int weight;
cin >> weight;
char sex;
cin >> ws >> sex;
bool isfemale = (tolower(sex) == 'k');
cout << "icm=" << icm[isfemale] (&weight) << endl;
return 0; }
}
}
Nie wiem do końca jak to ma wyglądać.
Tak jak mówiłem, dopiero zaczynam z programowaniem
Oto błędy :
!