that_one_nigga_you_k

coisa linda

Dec 18th, 2016
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <locale.h>
  4.  
  5. using namespace std;
  6.  
  7. float potencia(float q, float w, float e){
  8.  
  9.     return(q+(pow(w,e)));
  10. }
  11.  
  12. float logaritmo(float v, float j ){
  13.    
  14.     return(log(j)/log(v));
  15. }
  16.  
  17. int main(){
  18.     setlocale(LC_ALL,"portuguese");
  19.    
  20.     int j;
  21.     cout<<"digite 1 para função exponencial, 2 para logarítmica: ";
  22.     cin>>j;
  23.    
  24.     if(j==1){  
  25.     float a;
  26.     cout<<"digite o número adicional: ";
  27.     cin>>a;
  28.    
  29.     float b;
  30.     cout<<"digite a base: ";
  31.     cin>>b;
  32.    
  33.     float c;
  34.     cout<<"digite o expoente: ";
  35.     cin>>c;
  36.    
  37.     cout<<"o resultado é: "<<potencia(a,b,c);    
  38.     }
  39.    
  40.     else{
  41.    
  42.         float f;
  43.         cout<<"digite a base: ";
  44.         cin>>f;
  45.        
  46.         float g;
  47.         cout<<"digite o logaritmando: ";
  48.         cin>>g;
  49.        
  50.        
  51.        
  52.         cout<<"o expoente é: "<<logaritmo(f,g);
  53.     }
  54. }
Add Comment
Please, Sign In to add comment