Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <locale.h>
- using namespace std;
- float potencia(float q, float w, float e){
- return(q+(pow(w,e)));
- }
- float logaritmo(float v, float j ){
- return(log(j)/log(v));
- }
- int main(){
- setlocale(LC_ALL,"portuguese");
- int j;
- cout<<"digite 1 para função exponencial, 2 para logarítmica: ";
- cin>>j;
- if(j==1){
- float a;
- cout<<"digite o número adicional: ";
- cin>>a;
- float b;
- cout<<"digite a base: ";
- cin>>b;
- float c;
- cout<<"digite o expoente: ";
- cin>>c;
- cout<<"o resultado é: "<<potencia(a,b,c);
- }
- else{
- float f;
- cout<<"digite a base: ";
- cin>>f;
- float g;
- cout<<"digite o logaritmando: ";
- cin>>g;
- cout<<"o expoente é: "<<logaritmo(f,g);
- }
- }
Add Comment
Please, Sign In to add comment