Tarefa Complementar 6
#include <cstdlib>
#include <iostream>
#include <cmath> using namespace std;
int main(int argc, char *argv[])
{
double x; cout << "Entre com x= "; cin >> x; if ( x <= -10.0) { double y= pow (M_E, x) + log (fabs (x - 10.0)); cout << "y= " << y << endl; } else if (x > -10.0) { double y= x * x + sqrt (fabs (x)); cout << "y= " << y << endl; }
system("PAUSE"); return EXIT_SUCCESS;
}
6.7
#include <cstdlib>
#include <iostream>
#include <cmath> using namespace std;
int main(int argc, char *argv[])
{
double x; cout << "Entre com x= "; cin >> x; if ( x == -2.0 || x == 2.0) cout << "Nao existe funcao definida" << endl; else if ( x < -2.0) { double y= sqrt (fabs (x + 1.0)); cout << "y= " << y << endl; } else if (x > 2.0) { double y= sqrt (fabs (1.0 - x)); cout << "y= " << y << endl; } else { double y= 0.0; cout << "y= " << y << endl; } system("PAUSE"); return EXIT_SUCCESS;
}
6.10
#include <cstdlib>
#include <iostream>
#include <cmath> using namespace std;
int main(int argc, char *argv[])
{
double x, y; cout << "Entre com x= "; cin >> x; cout << "Entre com y= "; cin >> y; //double z= ((1.0 / (2.0 - x)) + (sqrt (fabs (x))) - (log (y - 5.0)));
double z= log (y - 5.0); cout << "z= " << z << endl; system("PAUSE"); return EXIT_SUCCESS;
}
6.17
#include <cstdlib>
#include <iostream>
#include <cmath> using namespace std;
int main(int argc, char *argv[])
{
int x, y; cout << "Entre com a dezena: "; cin >> x; cout << "Entre com a unidade: "; cin >> y; if (x == 0) { if (y <= 4) { double dinheirox= 0; double dinheiroy= y; cout << "Notas de 5.00= " << dinheirox << endl;