Tarefa complementar - c++
}
8.7 #include <iostream> #include <cmath> #include <cstdlib> using namespace 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 do exponencial 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 seu modulo 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)); } int