Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <math.h>
- #include <conio.h>
- using namespace std;
- double a,b,c,d,w;
- int i,j,z;
- int main(){
- do{
- system("cls");
- cout<<"*-*-*-*-*- Program -*-*-*-*-*"<<endl;
- cout<<"Pole kola [1]"<<endl;
- cout<<"Pierwiastek z odejmowania [2]"<<endl;
- cout<<"Petla for [3]"<<endl;
- cout<<"Koniec [0]"<<endl;
- cin>>z;
- system("cls");
- switch(z){
- case 1:
- cout<<"*-*-*-*-*- Pole kola -*-*-*-*-*"<<endl;
- cout<<"Wpisz promien: "<<endl;
- cin>>a;
- if(a>0){
- w=M_PI*pow(a,2);
- cout<<"Pole kola o promieniu: "<<a<<" wynosi: "<<w<<endl;
- }
- else{
- cout<<"Promien musi byc wiekszy od zera"<<endl;
- }
- getch();
- break;
- case 2:
- cout<<"Pierwiastek z odejmowania dwoch liczb"<<endl;
- cout<<"Wpisz pierwsza liczbe: "<<endl;
- cin>>a;
- cout<<"Wpisz druga liczbe: "<<endl;
- cin>>b;
- w=a-b;
- cout<<a<<"-"<<b<<"="<<w<<endl;
- if(w>=0){
- c=sqrt(w);
- cout<<"Pierwiastek z "<<w<<"="<<c<<endl;
- }
- else{
- cout<<"Brak pierwiastka z liczby ujemnej"<<endl;
- }
- getch();
- break;
- case 3:
- cout<<"Petla for"<<endl;
- cout<<"Wpisz a: "<<endl;
- cin>>a;
- cout<<"Wpisz b: "<<endl;
- cin>>b;
- if(a>b){
- for(i=b;i<=a;i++){
- cout<<"i = "<<i<<endl;
- }
- }
- else{
- for(i=a;i<=b;i++){
- cout<<"i = "<<i<<endl;
- }
- }
- getch();
- break;
- case 0:
- cout<<"Koniec"<<endl;
- break;
- default:
- cout<<"Zly operator"<<endl;
- getch();
- break;
- }
- }while(z!=0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement