# Tarefa complementar - c++

Páginas: 2 (481 palavras) Publicado: 8 de abril de 2013
8.6
#include <iostream>
#include <cmath>
#include <cstdlib>

using namespace std;

double logar (double a, double b)
{
return log (a) / log (b);
}

intmain(int argc, const char * argv[])
{
double L, l, l1;
cout << "De o valor do log e da base para transformar" ;
cin >> L >> l;
l1 = logar (L, l);
cout<< "Log = " << l1 << endl;

system ("Pause");
return 0;
}

8.7
#include <iostream>
#include <cmath>
#include <cstdlib>

usingnamespace std;

double raiz (double x, double n)
{
return pow (x, n);
}

int main(int argc, const char * argv[])
{
double a, b, c, x;
cout << "De os dois valores doexponencial e o valor de x para calcular a raiz" ;
cin >> a >> b >> x;
c = raiz (x, a/b);
cout << "Raiz = " << c << endl;

system("Pause");
return 0;
}

8.13
#include <iostream>
#include <cmath>
#include <cstdlib>

using namespace std;

double valabs (double x)
{
double y;
if (x< 0.0)
y = -x;
else
y = x;
return y;
}

int main(int argc, const char * argv[])
{
double a, b;
cout << "De o valor de x para retornar seumodulo absoluto" ;
cin >> a;
b = valabs (a);
cout << "Modulo = " << b << endl;

system ("Pause");
return 0;
}

8.14
#include<iostream>
#include <cmath>
#include <cstdlib>

using namespace std;

double dist (double x1, double y1, double z1, double x2, double y2, double z2)
{
return sqrt( pow (x2-x1,2.0) + pow (y2-y1, 2.0) + pow (z2-z1,2.0));
}

double area (double a, double b, double c)
{
double sp;
sp = (a+b+c)/2.0;
return sqrt (sp*(sp-a)*(sp-b)*(sp-c));
}...

Por favor, assinar para o acesso.