Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <cmath>
- using namespace std;
- double acquisisci()
- {
- double x;
- system("cls");
- cout<<"Dato un numero, se è pari fa il quadrato altrimenti il cubo..."<<endl;
- cout<<"Inserire un numero: ";
- cin>>x;
- return x;
- }
- double quadr(double x)
- {
- x=x*x;
- return x;
- }
- double cubo(double x)
- {
- x=pow(x,3);
- return x;
- }
- void visualizza(double x)
- {
- cout<<"Risultato: ";
- cout<<x;
- }
- int se(double i)
- {
- cin>>i;
- return i;
- }
- int exit(double y)
- {
- }
- int main()
- {
- int x,y,i;
- while(1)
- {
- x=acquisisci();
- if(x%2==0)
- {
- x=quadr(x);
- }
- else
- {
- x=cubo(x);
- }
- cout<<endl;
- visualizza(x);
- cout<<endl<<endl;
- cout<<"Vuoi Continuare ?";
- cout<<endl<<"[1]Si"<<endl<<"[2]No"<<endl;
- cout<<endl;
- cin>>i;
- cout<<endl;
- if(i==2)
- {
- system("pause");
- return EXIT_SUCCESS;
- }
- }
- system("pause");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement