Vous êtes sur la page 1sur 4

/*

=================================================================================
Universidad Industrial de Santander LEONEL PARRA PINILLA Escuela sistemas UIS
ESTUDIANTE________________________ Ejercicios para escribir en visual studio c++
ESCRIBIR PROGRAMA INTERACTIVO CALCULADORA FX-UIS USANDO MENU DE OPCIONES
=================================================================================
*/

// EJERCICIO INTERACTIVO CALCULADORA FX-UIS USANDO MENU DE OPCIONES

#include <iostream>
using namespace std;

int op,fx;

void fijo()
{
std::cout << "\n SOLUCION USANDO FUNCIONES";
cout << "\n =======================";
cout << "\n titulo permanente";
cout << "\n =======================\n";
}

void limpiar()
{
system("cls");
}

/*
=================================================================================
Universidad Industrial de Santander LEONEL PARRA PINILLA Escuela sistemas UIS

función TIPO void opciones() para mostrar las funciones de la calculadora FX_UIS
=================================================================================

void opciones()
{
//Verde

cout << "\nFUNCIONES CALCULADORA FX-UIS \n ";


cout << "\n 1. FUNCION 1 ";
cout << "\n 2. FUNION 2 ";
cout << "\n 3. FUNCION 3 ";
cout << "\n ... otras FUNCIONES";
cout << "\n 9. para TERMINAR "; // terminar con 9
cout << "\n\n Digite opcion ";
cin >> op;

/*
=================================================================================
Universidad Industrial de Santander LEONEL PARRA PINILLA Escuela sistemas UIS

función TIPO void suma() sumar dos números x y


=================================================================================
void suma()
{
float x, y, z;

cout << "\n SUMA DE DOS NUMEROS ";


cout << "\n =======================\n";
cout << " Digite numero x = a ";
cin >> x;
cout << " Digite numero y = a ";
cin >> y;
z = x + y;
cout << "\n Suma = a " << z << endl;
system("pause");
system("cls");
}

/*
=================================================================================
Universidad Industrial de Santander LEONEL PARRA PINILLA Escuela sistemas UIS

función TIPO void producto() producto de dos números x y


=================================================================================

void producto()
{
float x, y, z;
cout << "\n PRODUCTO DE DOS NUMEROS ";
cout << "\n =======================\n";
cout << " Digite numero x = a ";
cin >> x;
cout << " Digite numero y = a ";
cin >> y;
z = x * y;
cout << "\n\n producto = a " << z<<endl;
system("pause");
system("cls");
}

/*
=================================================================================
Universidad Industrial de Santander LEONEL PARRA PINILLA Escuela sistemas UIS

función TIPO void factorial() hallar x! factorial de x


=================================================================================

void factorial()
{
int i,x;
cout << "\n FACTORIAL DE UN NUMERO ";
cout << "\n =======================\n";
cout << " Digite numero x = a ";
cin >> x;
fx = 1;
for (i = 1; i <= x; i = i + 1) // factorial fd del denominador
{
fx = fx * i;
}
cout << "\n\n factorial de " << x << " = "<<fx;
system("pause");
system("cls");
}

/*
=================================================================================
Universidad Industrial de Santander LEONEL PARRA PINILLA Escuela sistemas UIS

función TIPO void perfecto() saber si un numero x es un numero perfecto


=================================================================================

void perfecto()
{
std::cout << " HALLAR SI UN NUMERO ES PERFECTO \n";

int x, i, fin, sd, co, pro;


cout << "\n Teclee el numero x = ";
cin >> x;
sd = 0;
fin = x - 1;
for (i = 1; i <= fin; i = i + 1) // para los divisores exactos
{
co = int(x / i);
pro = co * i;
if (x == pro)
{
sd = sd + i;
}
}
if (sd == x)
{
cout << "\n" << x << " es un numero perfecto ";
}
else {
cout << "\n " << x << " NO ES un numero perfecto ";
}
system("pause");
system("cls");
}

*/
=================================================================================
Universidad Industrial de Santander LEONEL PARRA PINILLA Escuela sistemas UIS

ESTRUCTURA int main() que usa interactivamente la calculadora FX_UIS


=================================================================================
*/

// ESTRUCTURA int main()

int main()
{
fijo();
do
{
opciones();

switch (op)
{
case 1: { suma(); fijo(); break; }

case 2: { producto(); fijo(); break; }

case 3: { factorial(); fijo(); break; }

case 4: { perfecto(); fijo(); break; }

// case 5 hacer mas opciones


}
} while (op != 9);

cout << "Termina sistema ";


return 0;
}

/*
=================================================================================
Universidad Industrial de Santander UIS Escuela SISTEMAS UIS
PROFESOR LEONEL PARRA PINILLA ESTUDIANTE _______________________________
=================================================================================
*/

Vous aimerez peut-être aussi