Created
January 6, 2019 20:23
-
-
Save savolla/bdfd1cb77d4b356c5b2a030777e514da to your computer and use it in GitHub Desktop.
final 1. soru c++ kodu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
double karekok(unsigned int x) | |
{ | |
return sqrt(x); | |
} | |
double quadkok(unsigned int x) | |
{ | |
return pow(x, 0.25); | |
} | |
int kup(int x) | |
{ | |
return pow(x, 3); | |
} | |
int main(void) | |
{ | |
// değişkenler | |
unsigned int islenecekSayi; | |
short islemSecimi; | |
// kullanıcıdan sayi al | |
cin >> islenecekSayi; | |
// dialog | |
cout << "1- karekok" << endl; | |
cout << "2- quadkok" << endl; | |
cout << "3- 3th power" << endl; | |
// dialogta gösterilen sayılardan birinin kullanıcıdan al | |
cin >> islemSecimi; | |
// islem seçimine göre sayi ile işlem yap | |
switch(islemSecimi) | |
{ | |
case 1: | |
cout << karekok(islenecekSayi); | |
break; | |
case 2: | |
cout << quadkok(islenecekSayi); | |
break; | |
case 3: | |
cout << kup(islenecekSayi); | |
break; | |
default: | |
cout << "tekrar deneyiniz" << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment