#include <iostream>
#include <cmath>
#include <string>
using namespace std;
double obliczKolo(double promien,string opcja) {
if (opcja == "obwod") {
return 2 * M_Pi * promien;
} else if (opcja == "pole") {
return M_Pi * pow(promien, 2);
} else {
cout << "Niepoprawna opcja.
Wybierz 'obwod' lub 'pole'." << endl;
return 0;
}
}
int main() {
double promien;
string opcja;
cout << "Podaj promień koła: ";
cin >> promien;
cout << "Wybierz 'obwod' lub
'pole': ";
cin >> opcja;
double wynik = obliczKolo(promien,
opcja);
cout << "Wynik: " << wynik << endl;
return 0;
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: