Archived
1
0
Fork 0

🍻 More excercise files

This commit is contained in:
Simon V. Lejel 2024-02-06 18:40:58 +01:00
parent f4330e53e0
commit 1b6aabc1b5
Signed by: sl
GPG key ID: 6544A0430A2CFFAD
2 changed files with 30 additions and 0 deletions

15
src/excercises/celsius.cc Normal file
View 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
View 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;
}