
10. MENDOZA ANTIZANA JOSE FERNANDO
#include <iostream>
#include <cmath>
using namespace std;
int angulo, Opcion, c, SUMA, dias, horas, minutos, segundos, segundostotales;
int FACT, CC, n, a, b, A, CALCULAR_SEGUNDOS(int d, int m, int h, int s);
float M, N, RAD, B, PI = 3.141592, nota1, nota2, nota3, notafinal; //(2)
float SERIE_SENO(int x), NOTA_FINAL(float nota1, float nota2, float nota3);
int SUMAR(int x, int y); //(2): DECLARACIÓN DE FUNCIONES
int main()
{
do
{
cout << " M E N U de FUNCIONES \n";
cout << "------------ \n";
cout << "1.- SUMA \n";
cout << "2.- SERIE SENO \n";
cout << "3.- NOTA FINAL \n";
cout << "4.- SU LIBRO \n";
cout << "INGRESE UNA OPCION <> 0: ";
cin >> Opcion;
switch (Opcion)
{
case 1:
{
cout << "1.- SUMA DE DOS NUMEROS \n";
cout << "Ingrese el numero 1: ";
cin >> a;
cout << "Ingrese el numero 2: ";
cin >> b;
A = SUMAR(a, b); //(1) INVOCACION
cout << "la suma es: " << A << endl;
cout << endl;
};
break;
case 2:
{
cout << "2.- SERIE SENO \n";
cout << "------------------ \n";
cout << "Ingrese el valo del angulo:";
cin >> angulo;
B = SERIE_SENO(angulo); //(1)
cout << "La suma de la serie seno es: " << B << endl;
cout << endl;
};
break;
case 3:
{
cout << "3.- NOTA FINAL \n";
cout << "----------------------- \n";
cout << "Ingrese la primera nota: ";
cin >> nota1;
cout << "Ingrese la segunda nota: ";
cin >> nota2;
cout << "Ingrese la tercera nota: ";
cin >> nota3;
notafinal = NOTA_FINAL(nota1, nota2, nota3);
cout << "La nota final del estudiante es: " << notafinal << endl;
cout << endl;
};
break;
case 4:
{
cout << "4.- CALCULAR SEGUNDOS \n";
cout << "--------------- \n";
cout << "Ingrese la cantidad de dias: ";
cin >> dias;
cout << "Ingrese la cantidad de horas: ";
cin >> horas;
cout << "Ingrese la cantidad de minutos: ";
cin >> minutos;
cout << "Ingrese la cantidad de segundos: ";
cin >> segundos;
segundostotales = CALCULAR_SEGUNDOS(dias, horas, minutos, segundos);
cout << "La cantidad de segundos en el tiempo que se ingreso es de: " << segundostotales << endl;
cout << endl;
}
} // fin del switch
} while (Opcion != 0); // FIN DEL DO WHILE
return 0;
} // FIN PROGRAMA
// zona de desarrollo de funciones
int SUMAR(int x, int y) // (3) INICO FUNCIONES
{
SUMA = x + y;
return SUMA; // retorno con valor
} // (4) DESARROLLO
float SERIE_SENO(int x) //(3)
{
RAD = (2 * PI * x) / 360;
CC = 0;
SUMA = RAD;
FACT = 1;
cout << "Cuanto terminos sumamos: ";
cin >> n;
for (c = 1; c <= n; c = c + 2)
{
M = pow(RAD, c);
N = FACT * c;
CC = CC + 1;
if (CC / 2 != 0)
SUMA = SUMA + M / N;
else
SUMA = SUMA - M / N;
}
return SUMA;
} //(4)
float NOTA_FINAL(float n1, float n2, float n3)
{
notafinal = n1 * 0.3 + n2 * 0.3 + n3 * 0.4;
return notafinal;
}
int CALCULAR_SEGUNDOS(int d, int h, int m, int s)
{
int cantidadsegundos = 0;
cantidadsegundos += s;
cantidadsegundos += m * 60;
cantidadsegundos += h * 60 * 60;
cantidadsegundos += d * 24 * 60 * 60;
return cantidadsegundos;
}



