Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using std::cin;
- using std::cout;
- using std::endl;
- int main() {
- double luku;
- char choice;
- char L = 'L';
- int l = 'l';
- double tulos;
- double tulos1;
- double tulos2;
- double tulos3;
- cout << "Valitse luku. \n";
- cin >> luku;
- cout << "Valitse laskutoimitus (1=Neliojuuri 2=log 3=exp 4=tan L = Lopetus) \n";
- cin >> choice;
- while (choice != 'L' && choice != 'l')
- {
- if (choice == '1')
- {
- tulos = sqrt(luku);
- cout << "Syottamasi luvun neliojuuri on " << tulos << endl;
- cout << "Valitse luku. \n";
- cin >> luku;
- cout << "Valitse laskutoimitus (1=Neliojuuri 2=log 3=exp 4=tan L = Lopetus) \n";
- cin >> choice;
- }
- else if (choice == '2')
- {
- tulos1 = log(luku);
- cout << "syottamasi luvu logaritmi on " << tulos1 << endl;
- cout << "Valitse luku. \n";
- cin >> luku;
- cout << "Valitse laskutoimitus (1=Neliojuuri 2=log 3=exp 4=tan L = Lopetus) \n";
- cin >> choice;
- }
- else if (choice == '3')
- {
- tulos2 = exp(luku);
- cout << "Syottamasi luvun eksponentti on " << tulos2 << endl;
- cout << "Valitse luku. \n";
- cin >> luku;
- cout << "Valitse laskutoimitus (1=Neliojuuri 2=log 3=exp 4=tan L = Lopetus) \n";
- cin >> choice;
- }
- else if (choice == '4')
- {
- tulos3 = tan(luku);
- cout << "Syottamasi luvun tangentti on " << tulos3 << endl;
- cout << "Valitse luku. \n";
- cin >> luku;
- cout << "Valitse laskutoimitus (1=Neliojuuri 2=log 3=exp 4=tan L = Lopetus) \n";
- cin >> choice;
- }
- }
- cout << "Ei laskemista, selkee! \n";
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement