🍻 More excercise files
This commit is contained in:
parent
f4330e53e0
commit
1b6aabc1b5
2 changed files with 30 additions and 0 deletions
15
src/excercises/celsius.cc
Normal file
15
src/excercises/celsius.cc
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
|
||||
int fahrenheit;
|
||||
cout << "Enter fahrenheit value: ";
|
||||
cin >> fahrenheit;
|
||||
double celsius = (fahrenheit - 32) / 1.8;
|
||||
cout << "Celsius: " << celsius;
|
||||
|
||||
return 0;
|
||||
}
|
15
src/excercises/circles.cc
Normal file
15
src/excercises/circles.cc
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
|
||||
int radius;
|
||||
cout << "Enter radius of circle: ";
|
||||
cin >> radius;
|
||||
|
||||
// I'm awesome, the teacher didn't know about the PI constant in cmath
|
||||
cout << "Result: " << M_PI * pow(radius, 2);
|
||||
return 0;
|
||||
}
|
Reference in a new issue