lol
unknown
c_cpp
3 years ago
1.2 kB
10
Indexable
#include <iostream>
#include <math.h>
using namespace std;
float pole(int r)
{
int kwadrat = sqrt(r);
return 4 * 3.14 * kwadrat;
}
float objetosc(int r)
{
int kwadrat = sqrt(r);
return 1.34 * 3.14 * kwadrat;
}
int main()
{
int wybor = 0;
int r_kola = 0;
cout << "1. Pole Kuli \n2. Objetosc Kuli \n3. Liczenie Aretmatycznej\n";
cin >> wybor;
if (wybor == 1)
{
cout << "Podaj R (promien): ";
cin >> r_kola;
cout << "Pole Wynosi " << pole(r_kola) << endl << endl << endl << endl;
main();
}
if (wybor == 2)
{
cout << "Podaj R (promien): ";
cin >> r_kola;
cout << "Objetosc Wynosi " << objetosc(r_kola) << endl << endl << endl << endl;
main();
}
if (wybor == 3)
{
int suma = 0;
char liczba = 0;
int ilosc = 0;
int konwertowane;
cout << "Podaj Liczby ( kliknij e by wyjsc )" << endl;
while (true)
{
cin >> liczba;
if (liczba == 'e')
{
break;
}
else
{
konwertowane = liczba - '0';
suma += konwertowane;
ilosc++;
}
}
cout << "\nSrednia Aretmatyczna: " << suma / ilosc << endl << endl;
main();
}
return 0;
}Editor is loading...