Documentos de Académico
Documentos de Profesional
Documentos de Cultura
getch();
}
#include "stdafx.h"
#include "iostream"
#include<conio.h>
using namespace System;
using namespace std;
int main()
{
int n, t, m, p;
Console::WriteLine(L"Tablas de 1 a N con 20 productos");
cout << "Tecle n (numero de tablas) = a ";
cin >> n;
for (t = 1; t <= n; t = t + 1) // hacer c/u de las n tablas
{
cout << " Tabla del " << t << " con 20 productos" << endl;
for (m = 1; m <= 20; m = m + 1) // cada multiplicando
{
p = m*t;
cout << m << " * " << t << " = " << p << endl;
} // fin del for m 20 productos de cada tabla
cout << " Pulse tecla para seguir";
getch();
Console::Clear(); // ver cada tabla por pantalla
} // fin del for t tablas del 1 al n
}
3. CORRECCIÓN RAÍCES DE UNA FUNCIÓN GRADO DOS.
#include "stdafx.h"
#include "iostream"
#include<conio.h>;
#include<math.h>; // librería de funciones matemáticas
using namespace System;
using namespace std;
int main()
{
float a, b, c, x1, x2, r, t;
Console::WriteLine(L"Solución ecuación de segundo orden");
cout << "\n Tecle coeficiente a = ";
cin >> a;
cout << "\n Tecle coeficiente b = ";
cin >> b;
cout << "\n Tecle coeficiente c = ";
cin >> c;
r = b*b - 4 * a*c; // calcular discriminante
if (r >= 0) // la raíz esta en el campo de los reales
{
t = sqrt(r); // raíz cuadrada del discriminante
x1 = (-1 * b + t) / 2 * a; // dos raíces + - según fórmula
x2 = (-1 * b - t) / 2 * a;
cout << "\n Raíz X1 = " << x1 << "\n Raíz X2 = " << x2;
}
else {
cout << "\n Ecuación tiene raíces imaginarias ";
}
getch();
}
4. ENCONTRAR EL MAYOR Y EL MENOR DE UN VECTOR (A) Y
SU POSICIÓN (B).
#include "stdafx.h"
#include "iostream"
#include<conio.h>
using namespace System;
using namespace std;
int main()
{
int A[100], i, n, p1, p2, may, men; // definición de variables, Vector A de
hasta 100 datos
Console::WriteLine(L"Hallar el mayor y menor elemento de un ");
Console::WriteLine(L"Vector A de n elementos, indicando la ");
Console::WriteLine(L"posición que tienen en el Vector. ");
cout << "\n Teclee el número de datos n = ";
cin >> n;
for (i = 1; i <= n; i = i + 1) // Lectura del Vector A de n elementos
{
cout << "Dato " << i << " = ";
cin >> A[i];
}
may = A[1]; //Se supone el primer dato como mayor y menor
men = A[1];
p1 = 1;
p2 = 1;
for (i = 2; i <= n; i = i + 1) // Hallar mayor y menor al tiempo.
{
if (A[i]>may)
{
may = A[i];
p1 = i; // Guardar la posición del mayor
}
else {
if (A[i]<men)
{
men = A[i];
p2 = i; // Guardar la posición del menor
}
}
} // fin del for i, para comparar todos
cout << "El mayor es " << may << " y esta en la posición " << p1 << endl;
cout << "El menor es " << men << " y esta en la posición " << p2 << endl;
getch(); // parada temporal hasta pulsar tecla (visualizar la solución)
}
5. PRODUCTO MATRIZ.
#include "stdafx.h"
#include "iostream"
#include<conio.h>;
using namespace System;
using namespace std;
int main()
{
int a[10][10], b[10][10], c[10][10];// definicion de Matrices a, b, c, hasta
10x10 elementos
int i, j, n, m, k, l, x;
// Se lee el orden de la matriz a ( n x m )
Console::Write(L" Numero de filas de la matriz a n = "); cin >> n;
Console::Write(L" Numero de columnas m = "); cin >> m;
// Se lee el orden de la matriz b ( k x l )
Console::Write(L" Numero de filas de la matriz b k = "); cin >> k;
Console::Write(L" Numero de columnas l = "); cin >> l;
/* Proceso para calcular el producto de dos matrices a y b. El producto es
posible solo si (m) numero de columnas de la matriz que premultiplica (a),
es igual al numero de filas (k) de la matriz (b) que posmultiplica.
Se verifica si m=k ==> cumplen la condicion anterior, y se pueden
multiplicar,
siendo el resultado la matriz c de orden nxl.
*/
if (m == k) { // si se pueden muiltiplicar, se leen las dos matrices
cout << "\nTeclear datos de la matriz a";
for (i = 1; i <= n; i = i + 1) // aqui seria ==> hasta n filas para a
{
for (j = 1; j <= m; j = j + 1) // aqui seria ==> hasta m
columnas
{
cout << "\n dato a[" << i << "][" << j << "] = ";
cin >> a[i][j];
}
}
// se lee la matriz b de orden k x l
cout << "\nTeclear datos de la matriz b";
for (i = 1; i <= k; i = i + 1) // aqui seria ==> hasta k filas
{
for (j = 1; j <= l; j = j + 1) // aqui seria ==> hasta l columnas
{
cout << "\n dato b[" << i << "][" << j << "] = ";
cin >> b[i][j];
}
}
// inicia proceso para producto de axb
for (i = 1; i <= n; i = i + 1) // aqui seria ==> hasta n filas
{
for (j = 1; j <= l; j = j + 1) // aqui seria ==> hasta l columnas
{
c[i][j] = 0; // para acumular cada elemento de c
for (x = 1; x <= m; x = x + 1)
{
c[i][j] = c[i][j] + a[i][x] * b[x][j];
}// cada elemento de c es igual Suma del producto
// de los elementos de la fila de a por los de la
// columna de b
}
}
// Proceso par imprimir la matriz suma c
cout << "La matriz c producto de a x b es: " << endl;
for (i = 1; i <= n; i = i + 1) // imprimir c/u de las n filas
{
for (j = 1; j <= l; j = j + 1) // l columnas
{
cout << " " << c[i][j]; //imprime cada elemento de la
respectiva fila
} //separado por un espacio
cout << "\n"; // para cambiar a nueva linea de impresion en la
patalla
}
}// cierre del if
else { // no se pueden multiplicar (diferente columnas de a con filas de b))
cout << "\nNo se pueden Multiplicar; matrices de distinto orden";
}
cout << "\n Termina programa";
getch();
}
6. SUMA MATRIZ.
#include "stdafx.h"
#include "iostream"
#include<conio.h>;
using namespace System;
using namespace std;
int main()
{
int a[10][10], b[10][10], c[10][10];// definicion de Matrices a, b, c, hasta 10x10
elementos
int i, j, n, m, k, l;
// Se lee el orden de la matriz a ( n x m )
Console::Write(L" Numero de filas de la matriz a n = "); cin >> n;
Console::Write(L" Numero de columnas m = "); cin >> m;
// se lee la matriz a de orden n x m
for (i = 1; i <= n; i = i + 1) // aqui seria ==> hasta n filas
{
for (j = 1; j <= m; j = j + 1) // aqui seria ==> hasta m columnas
{
cout << "\n dato a[" << i << "][" << j << "] = ";
cin >> a[i][j];
}
}
// Se lee el orden de la matriz b ( k x l )
Console::Write(L" Numero de filas de la matriz b k = "); cin >> k;
Console::Write(L" Numero de columnas l = "); cin >> l;
// se lee la matriz b de orden k x l
for (i = 1; i <= k; i = i + 1) // aqui seria ==> hasta k filas
{
for (j = 1; j <= l; j = j + 1) // aqui seria ==> hasta l columnas
{
cout << "\n dato b[" << i << "][" << j << "] = ";
cin >> b[i][j];
}
}
/* Proceso para calcular la suma de los dos matrices a y b
La suma de dos matrices a y b es otra matriz c (c = a + b)
Primero se verifica si son del mismo orden, de lo contrario
no se pueden sumar
*/
if (n == k) {
if (m == l) {// si se pueden sumar (son del mismo orden)
// Proceso para la suma de dos matrices
for (i = 1; i <= n; i = i + 1) // aqui seria ==> hasta n, o k filas
{
for (j = 1; j <= m; j = j + 1) // aqui seria ==> hasta m, o l
columnas
{
c[i][j] = a[i][j] + b[i][j]; //Suma elemento a elemento
por fila
}
}
// Proceso par imprimir la matriz suma c
cout << "La matriz c suma de a + b es: " << endl;
for (i = 1; i <= n; i = i + 1) // imprimir c/u de las n filas
{
for (j = 1; j <= m; j = j + 1) // m columnas
{
cout << " " << c[i][j]; //imprime cada elemento de la
respectiva fila
} //separado por un espacio
cout << "\n"; // para cambiar a nueva linea de impresion en la
patalla
}
}// del if interno
else { // del if interno (no se pueden sumar(igual filas pero diferentes
columnas))
cout << "\nNo se pueden sumar matrices de distinto orden";
//getch();break; // romper proceso para salir
}
}// del 1er if
else {// del 1er if (no se pueden sumar(diferentes filas))
cout << "\nNo se pueden sumar matrices de distinto orden";
//getch();break; // romper proceso para salir
}
cout << " Termina programa";
getch();
}
7. MATRIZ NÚMEROS CONSECUTIVOS 9*9.
#include "stdafx.h"
#include "iostream"
#include<conio.h>;
using namespace System;
using namespace std;
int main()
{
int a[9][9];// definicion de Matrices a de 9x9
int i, j; // definicion de subindice i, j enteros
// Proceso para construir la matriz de la figura 1
for (i = 1; i <= 9; i = i + 1) // aqui varia segun las filas (aqui 9)
{
for (j = 1; j <= 9; j = j + 1) // varia segun las colunbas (aqui 9)
{
a[i][j] = i; // c/elemento igual al valor de la fila
} //termina for j de columnas
} // termina for i de filas
// Proceso par imprimir la matriz a (figura 1)
cout << "La matriz a de la figura 1 es:" << endl;
for (i = 1; i <= 9; i = i + 1) // imprimir c/u de las 9 filas
{
for (j = 1; j <= 9; j = j + 1) // 9 columnas
{
cout << " " << a[i][j]; //imprime cada elemento de la
respectiva fila
} //separado por un espacio
cout << "\n"; // para cambiar a nueva linea de impresion en la patalla
}
cout << "\n Termina programa";
getch();
}
8. MATRIZ IDENTIDAD.
#include "stdafx.h"
#include "iostream"
#include<conio.h>;
using namespace System;
using namespace std;
int main()
{
int A[10][10], i, j, n; // definicion de variables, Matriz A de hasta 10x10
elementos
// No se lee la matriz identidad
de orden N; sino que se hace la matriz.
// Matriz de orden n, quiere decir
matriz cuadrada de orden n (n x n )
// NOTA: 1a forma de hacer el
programa.
Console::Write(L" orden de la matriz identidad que desea n = ");
cin >> n;
for (i = 1; i <= n; i = i + 1) // aqui seria ==> hasta n filas
{
for (j = 1; j <= n; j = j + 1) // aqui seria ==> hasta n ( n x n)
{
if (i == j) // unos en la diagonal principal
{
A[i][j] = 1;
}
else {
A[i][j] = 0; // 0 todos los demas elementos
}
}
}
#include "stdafx.h"
#include "iostream"
#include<conio.h>
// 9 columnas
{
a[i][j] = h;
h = h + 1;
// c/elemento igual al valor de la fila
} //termina for j de columnas
}
b = 0;
for (i = 10; i<19; i = i + 1) // imprimir c/u de las 9 filas
{
p = 10;
b = b + 2;
o = i - 9;
for (k = 1; k <= b; k = k + 1)
{
cout << " ";
}
for (j = 1; j<20 - i; j = j + 1)
// 9 columnas
{
#include "iostream"
#include <conio.h>
int main() {
double num, ant, gua, suma;
num = 1;
ant = 0;
cout << "los numeros de la secuecia fibonacci son ";
cout << "0 , 1 ";
for (int i = 1; i<10; i = i + 1) {
gua = num;
num = num + ant;
cout << " , " << num;
ant = gua;
suma = suma + num;
}
suma = suma + 1;
cout << " su suma es " << suma << endl;
long long f, x, sp, p, sa;
f = suma - 1;
for (long a = 2; a<suma; a = a + 1) {
x = suma / a;
sp = x*a;
if (sp == suma) {
cout << " " << suma << ", no es primo";
a = f;
sa = 0;
}
else {
sa = 1;
}
}
if (sa == 1)
{
cout << " " << suma << ", es primo";
}
getch();
}
11. PARA N NÚMEROS ENTEROS X, BUSCAR EL
MAYOR, SUMAR LA CIFRAS DEL MAYOR Y DECIR SI
ESTA SUMA DA UN NÚMERO PERFECTO.
#include "stdafx.h"
#include "iostream"
#include <conio.h>
int main() {
float mayor, n, x;
int co, ci, p, sp;
cout << "¿cuantos numeros desea ingresar? "; cin >> n;
mayor = -100000000000;
mayor = x;
}
cout << "EL NUMERO MAYOR ES " << mayor << endl;
sp = 0;
co = 1;
while (co != 0) {
co = mayor / 10,
ci = co * 10;
p = mayor - ci;
sp = sp + p;
mayor = co;
}
cout << sp << endl;
sc = sc + i;
}
if (sc != sp) {
}
else
{
cout << "EL NUMERO ES PERFECTO";
getch();
}
12. PARA N>M HALLE COMBINATORIA (N,M) =
N!/(N-M)!, Y A ESTA SACAR RAÍZ CUADRADA SEGÚN
NEWTON(RAÍZ NEWTON DE X ES: SUPONGA UNA
RAÍZ XO, A PARTIR DE ESTA CALCULAR OTRA XN=
½(XO +X/XO) HASTA QUE |XN-XO| SEA MUY
PEQUEÑA )
#include "stdafx.h"
#include "iostream"
#include <conio.h>
int main() {
float n, m, combim, combin, combia, combinatoria, a;
combim = combim*im;
}
for (int in = 1; in <= n; in = in + 1) {
combin = combin*in;
combia = combia*ia;
}
combinatoria = combin / combia;
cout << "la combinatoria es igual a: " << combinatoria << endl;
float raiza, raizn;
raiza = 1;
for (int z = 1; z<11; z = z + 1) {
raizn = 0.5*(raiza + combinatoria / raiza);
raiza = raizn;
}
cout << "la raiz es = " << raiza;
getch();
}
13. ESCRIBA UN DIAGRAMA QUE PARA DATOS X
( X = ÁNGULO EN GRADOS ), CALCULE PARA CADA
UNO, SUS FUNCIONES SENO, COSENO, SECANTE,
COSECANTE, TANGENTE Y COTANGENTE. HACER
FUNCIÓN SENO Y COSENO POR EL MÉTODO
NUMÉRICO DE TAYLOR
#include "stdafx.h"
#include "iostream"
#include <conio.h>
int main() {
float x, a, rad, n, m, sen, cas, ton, cot, sic, csca, sent, cost;
if (cas == 0) {
cout << "tangente tiende a infinito" << endl;
cout << "secante tiende a infinito" << endl;
}
else {
ton = sen / cas;
cout << "tangente es igual a: " << ton << endl;
sic = 1 / cas;
cout << "secante es igual a: " << sic << endl;
}
if (sen == 0) {
cout << "cotangente tiende a infinito" << endl;
cout << "cosecante tiende a infinito" << endl;
}
else {
cot = cas / sen;
cout << "cotangente es igual a: " << cot << endl;
csca = 1 / sen;
cout << "cosecante es igual a: " << csca << endl;
}
float sx, e, d, sig, t, s, fd;
sx = 0;
e = 1;
d = 1;
sig = 1;
fd = fd * s;
}
float resultado = pow(rad, e);
sx = sx + (sig*(resultado / fd));
e = e + 2;
d = d + 2;
sig = -1 * sig;
}
cout << "el seno por taylor es igual a: " << sx << endl;
sx = 1;
e = 2;
d = 2;
sig = -1;
fd = fd * s;
}
float resultado = pow(rad, e);
sx = sx + (sig*(resultado / fd));
e = e + 2;
d = d + 2;
sig = -1 * sig;
}
cout << "el coseno por taylor es igual a: " << sx << endl;
}
}
14. PARA VARIOS DATOS X ( X = NÚMERO ENTERO
), ESTABLEZCA PARA CADA UNO SI ES PRIMO O NO
Y CUÁL ES EL MAYOR NÚMERO PRIMO HALLADO
#include "stdafx.h"
#include "iostream"
#include <conio.h>
int main() {
float mayor, n, x;
int co, f, ci, p, sp, sa;
cout << "¿cuantos numeros desea ingresar? "; cin >> n;
mayor = 0;
f = x - 1;
for (int a = 2; a<x; a = a + 1) {
ci = x / a;
sp = ci*a;
if (sp == x) {
cout << " " << x << ", no es primo" << endl;
a = f;
sa = 0;
}
else {
sa = 1;
}
}
if (sa == 1)
{
cout << " " << x << ", es primo " << endl;
if (x>mayor) {
mayor = x;
}
}
}
cout << "el mayor de los primos es: " << mayor;
getch();
}
15. PARA N NÚMEROS, CADA UNO CON CUALQUIER
NÚMERO DE CIFRAS, HALLE CUÁNTO VALE LA
SUMA DE LAS CIFRAS DE CADA NÚMERO Y CUÁL
ES LA MENOR SUMA DE CIFRAS DE LOS NÚMEROS
#include "stdafx.h"
#include "iostream"
#include <conio.h>
int main() {
float mayor, n, x, menor;
int co, ci, p, sp;
cout << "¿cuantos numeros desea ingresar? " << endl; cin >> n;
menor = 99999999999999;
co = x / 10,
ci = co * 10;
p = x - ci;
sp = sp + p;
x = co;
}
cout << "la suma de sus cifras es " << sp << endl;
if (sp<menor) {
menor = sp;
}
cout << "LA SUMA DE CIFRAS MENOR ES " << menor << endl;
getch();
}
#include "iostream"
#include <conio.h>
int main() {
float mayor, n, x, menor;
int co, ci, p, sp, a, b, c, d, e, f, g, h, i, j, s, z;
cout << "¿cuantos numeros desea ingresar? " << endl; cin >> n;
co = x / 10,
ci = co * 10;
p = x - ci;
x = co;
if (p == 0) {
a = a + 1;
}
if (p == 1) {
b = b + 1;
}if (p == 2) {
c = c + 1;
}if (p == 3) {
d = d + 1;
}if (p == 4) {
e = e + 1;
}if (p == 5) {
f = f + 1;
}if (p == 6) {
g = g + 1;
}if (p == 7) {
h = h + 1;
}
if (p == 8) {
i = i + 1;
}
if (p == 9) {
j = j + 1;
}
}
if (a >= b&&a >= c&&a >= d&&a >= e&&a >= f&&a >= g&&a >= h&&a
>= i&&a >= j&&a != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 0 " << endl;
}
if (b >= a&&b >= c&&b >= d&&b >= e&&b >= f&&b >= g&&b >= h&&b
>= i&&b >= j&&b != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 1 " << endl;
}
if (c >= b&&c >= a&&c >= d&&c >= e&&c >= f&&c >= g&&c >= h&&c
>= i&&c >= j&&c != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 2 " << endl;
}
if (d >= b&&d >= c&&d >= a&&d >= e&&d >= f&&d >= g&&d >= h&&d
>= i&&d >= j&&d != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 3 " << endl;
}
if (e >= b&&e >= c&&e >= d&&e >= a&&e >= f&&e >= g&&e >= h&&e
>= i&&e >= j&&e != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 4 " << endl;
}
if (f >= b&&f >= c&&f >= d&&f >= e&&f >= a&&f >= g&&f >= h&&f >=
i&&f >= j&&f != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 5" << endl;
}
if (g >= b&&g >= c&&g >= d&&g >= e&&g >= f&&g >= a&&g >= h&&g
>= i&&g >= j&&g != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 6 " << endl;
}
if (h >= b&&h >= c&&h >= d&&h >= e&&h >= f&&h >= g&&h >= a&&h
>= i&&h >= j&&h != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 7 " << endl;
}
if (i >= b&&i >= c&&i >= d&&i >= e&&i >= f&&i >= g&&i >= h&&i >=
a&&i >= j&&i != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 8 " << endl;
}
if (j >= b&&j >= c&&j >= d&&j >= e&&j >= f&&j >= g&&j >= h&&j >=
i&&j >= a&&j != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 9 " << endl;
}
}
getch();
}
#include "iostream"
#include <conio.h>
int main() {
if (a % 2 == 1) {
c = pow(10, b);
rta = c + rta;
}
a = a / 2;
t = b + 1;
}
x = pow(10, t);
rta = rta + x;
cout << "el binario de " << z << " es:" << rta << endl;
}
getch();
}
18. PARA NÚMEROS BINARIOS XB, HALLE CUÁL ES
EL EQUIVALENTE EN BASE 10 DE CADA BINARIO
#include "stdafx.h"
#include "iostream"
#include <conio.h>
int main() {
int a, b, c, h, ex, rta, i, z, s, t, x, n, f, co, si, sp, ci, p;
cout << "¿cuantos numeros desea ingresar? " << endl; cin >> n;
co = z / 10;
ci = co * 10;
p = z - ci;
f = pow(2, si);
sp = sp + p*f;
z = co;
si = si + 1;
}
cout << "el numero en base 10 es " << sp << endl;
}
getch();
}
19. PARA N DATOS ENTEROS CADA UNO CON
CUALQUIER NÚMERO DE CIFRAS, BUSQUE EL
MAYOR NÚMERO Y EL MENOR; INDIQUE CUÁNTAS
CIFRAS DEL MAYOR SON PARES Y DEL MENOR DIGA
CUANTAS CIFRAS SON MÚLTIPLO DE TRES.
#include "stdafx.h"
#include "iostream"
#include <conio.h>
int main() {
float mayor, menor, n, x;
int co, ci, p, sp;
cout << "¿cuantos numeros desea ingresar? "; cin >> n;
mayor = -100000000000;
menor = 999999999999;
mayor = x;
}
if (x<menor) {
menor = x;
}
cout << "EL NUMERO MAYOR ES " << mayor << endl;
cout << "EL NUMERO MENOR ES " << menor << endl; int a, y, z;
y = mayor;
z = menor;
sp = 0;
co = 1;
a = 0;
while (co != 0) {
co = mayor / 10;
ci = co * 10;
p = mayor - ci;
if (p % 2 == 0) {
a = a + 1;
}
mayor = co;
}
cout << "el numero de cifras pares de " << y << " es: " << a << endl;
sp = 0;
co = 1;
a = 0;
while (co != 0) {
co = menor / 10;
ci = co * 10;
p = menor - ci;
if (p % 3 == 0) {
a = a + 1;
}
menor = co;
}
cout << "el numero de cifras pmultiplos de tres de " << z << " es: " << a <<
endl;
getch();
}
CORRECCION PARCIAL
int main() {
float mayor, n, x;
int co, ci, p, sp, suma, total, a, b, dif, con, h, sumai;
cout << "¿cuantos numeros desea ingresar? " << endl; cin >> n;//ingresa
numero de vueltas
suma = 0;
h = x;
while (x != 0) {
a = x / 2,
b = a * 2;
dif = x - b;
total = total + (dif*pow(10, con)); //halla binarios
con = con + 1;
x = a;
}
cout << "el binario de " << h << " es: " << total << endl;
}
int c, r, m, f;
c = 0;
r = suma - 1;
for (int i = 1; i <= r; i = i + 1) {
m = suma / i;
f = m*i; // halle la suma de divisores
if (suma == f) {
c = c + i;
}
if (c != suma) {
cout << "la suma de los numeros= " << sumai << " no es un numero
perfecto" << endl;
}
else
{
cout << "Ela suma de los numeros= " << sumai << " es un numero
perfecto" << endl;
getch();
}
int main() {
suma = 0;
h = x;
i = 0;
rta = 0;
ex = log2(z);
a = z;
for (int b = 0; b<ex; b = b + 1) {
if (a % 2 == 1) {
c = pow(10, b);
rta = c + rta;
}
a = a / 2;
t = b + 1;
}
x = pow(10, t);
rta = rta + x;
cout << "el binario de " << z << " es:" << rta << endl;
}
int gh, r, m;
gh = 0;
r = suma - 1;
for (int i = 1; i <= r; i = i + 1) {
m = suma / i;
f = m*i; // halle la suma de divisores
if (suma == f) {
gh = gh + i;
}
}
if (gh != suma) {
cout << "la suma de los numeros= " << sumai << " no es un numero
perfecto" << endl;
}
else
{
cout << "Ela suma de los numeros= " << sumai << " es un numero
perfecto" << endl;
}
getch();
}
EJERCICIOS MULTIMEDIA
22. PRIMERA CALCULADORA CON FUNCIONES,
SUMA, RESTA, SENO COSENO
#include "stdafx.h"
#include "iostream"
#include<conio.h>
Console::WriteLine(L"===================================calculador
a laura uis================================");
}
void limpiaopciones()
{
int i;
linea = 5;
Console::SetCursorPosition(3, linea);
for (i = 1; i <= 32; i = i + 1)
{
cout << " ";
}
Console::ForegroundColor::set(ConsoleColor::White);//letra Blanca
linea = 5;
}
void opciones()
{
Console::ForegroundColor::set(ConsoleColor::Green);//letra Verde
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"calculadora laura uis");
Console::WriteLine(L"1. smua ");
Console::WriteLine(L"2. resta ");
Console::WriteLine(L"3. factorial ");
Console::WriteLine(L"4. decir si es perfecto ");
Console::WriteLine(L"5. primo o compuesto ");
Console::WriteLine(L"6. seno");
Console::WriteLine(L"7. coseno por taylor ");
Console::WriteLine(L"8.raiz ");
Console::WriteLine(L"... otras FUNCIONES");
Console::WriteLine(L"9. para TERMINAR ");
cout << "\n\n Digite opcion ";
cin >> op;
limpiaopciones();
}
void suma()
{
float x, y, z;
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" SUMA DE DOS NUMEROS ");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
cout << " Digite numero x = "; cin >> x;
cout << " Digite numero y = "; cin >> y;
z = x + y;
cout << "\n\n Suma = " << z;
Console::WriteLine(L"... Enter para salir ");
getch();
}
void producto()
{
float x, y, z;
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" PRODUCTO DE DOS NUMEROS ");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
cout << " Digite numero x = "; cin >> x;
cout << " Digite numero y = "; cin >> y;
z = x*y;
cout << "\n\n producto = " << z;
Console::WriteLine(L"... Enter para salir ");
getch();
}
void factorial()
{
float x, y, fd;
fd = 1;
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" Factorial de un numero ");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
cout << " Digite numero x = "; cin >> x;
for (y = 1; y <= x; y = y + 1) {
fd = fd*y;
}
cout << "\n\n factorial = " << fd;
Console::WriteLine(L"... Enter para salir ");
getch();
}
void primo()
{
int pp, f, ci, sa, x, sp;
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" diga si un numero es primo ");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
f = x - 1;
for (int a = 2; a<x; a = a + 1) {
ci = x / a;
sp = ci*a;
if (sp == x) {
cout << " " << x << ", no es primo" << endl;
a = f;
sa = 0;
}
else {
sa = 1;
}
}
if (sa == 1)
{
cout << " " << x << ", es primo " << endl;
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" diga si un numero es perfecto");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
int sc, pp, pl, f, x;
cout << "Ingrese el numero "; cin >> x;
sc = 0;
f = x - 1;
for (int i = 1; i <= f; i = i + 1) {
pp = x / i;
pl = pp*i;
if (pl == x) {
sc = sc + i;
}
if (sc != x) {
}
else
{
cout << "EL NUMERO " << x << " ES PERFECTO";
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" halle el seno");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
float x, a, rad, n, m, sen, cas, ton, cot, sic, csca, sent, cost;
cout << "Ingrese el angulo "; cin >> m;
fd = fd * s;
}
float resultado = pow(rad, e);
sx = sx + (sig*(resultado / fd));
e = e + 2;
d = d + 2;
sig = -1 * sig;
}
cout << "el seno por taylor es igual a: " << sx << endl;
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" halle el coseno");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
float x, a, rad, n, m, sen, cas, ton, cot, sic, sent, cost;
fd = fd * s;
}
float resultado = pow(rad, e);
sx = sx + (sig*(resultado / fd));
e = e + 2;
d = d + 2;
sig = -1 * sig;
}
cout << "el coseno por taylor es igual a: " << sx << endl;
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" halle la raiz");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
int x;
cout << "Ingrese el numero "; cin >> x;
float raiza, raizn;
raiza = 1;
for (int z = 1; z<11; z = z + 1) {
raizn = 0.5*(raiza + x / raiza);
raiza = raizn;
}
cout << "la raiz es = " << raiza;
Console::WriteLine(L"... Enter para salir ");
getch();
}
int main()
{
fijo();
do {
opciones();
switch (op)
{
case 1: { suma(); limpiaopciones(); break; }
case 2: { producto(); limpiaopciones(); break; }
case 3: { factorial(); limpiaopciones(); break; }
case 4: { perfecto(); limpiaopciones(); break; }
case 5: { primo(); limpiaopciones(); break; }
case 6: { seno(); limpiaopciones(); break; }
case 7: { coseno(); limpiaopciones(); break; }
case 8: { raiz(); limpiaopciones(); break; }
}
} while (op != 9);
cout << "Termina sistema ";
getch();
}
23. CORRECIÓN
MULTIMEDIA 1 CON LIMPIAOPCIONES,
SUMA PRODUCTO FACTORIAL
#include "stdafx.h"
#include "iostream"
#include<conio.h>
using namespace System;
using namespace std;
void fijo()
{
cout << "=======================";
cout << "titulo permanente";
Console::WriteLine(L"=======================");
}
void limpiaopciones()
{
int i;
linea = 5;
Console::SetCursorPosition(3, linea);
for (i = 1; i <= 15; i = i + 1)
{
cout << " ";
}
Console::ForegroundColor::set(ConsoleColor::White);//letra Blanca
linea = 5;
}
void opciones()
{
Console::ForegroundColor::set(ConsoleColor::Green);//letra Verde
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"FUNCIONES DE HP-XXX ");
Console::WriteLine(L"1. suma ");
Console::WriteLine(L"2. producto ");
Console::WriteLine(L"3. factorial ");
Console::WriteLine(L"... otras FUNCIONES");
Console::WriteLine(L"9. para TERMINAR ");
cout << "\n\n Digite opcion ";
cin >> op;
limpiaopciones();
}
void suma()
{
float x, y, z;
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" SUMA DE DOS NUMEROS ");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
cout << " Digite numero x = a "; cin >> x;
cout << " Digite numero y = a "; cin >> y;
z = x + y;
cout << "\n\n Suma = a " << z;
Console::WriteLine(L"... Enter para salir ");
getch();
}
void factorial()
{
float x, y, z, fd;
fd = 1;
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" factorial ");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
cout << " Digite numero x = a "; cin >> x;
for (int i = 1; i <= x; i = i + 1) {
fd = fd*i;
}
void producto()
{
float x, y, z;
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" PRODUCTO DE DOS NUMEROS ");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
cout << " Digite numero x = a "; cin >> x;
cout << " Digite numero y = a "; cin >> y;
z = x*y;
cout << "\n\n producto = a " << z;
Console::WriteLine(L"... Enter para salir ");
getch();
}
int main()
{
fijo();
do {
opciones();
switch (op)
{
case 1: { suma(); limpiaopciones(); break; }
case 2: { producto(); limpiaopciones(); break; }
case 3:{ factorial();limpiaopciones();break;}
}
} while (op != 9);
cout << "Termina sistema ";
getch();
}
void fijo()
{
cout << " ==============================";
cout << "\n PROGRAMA INTERACTIVO UIS ";
cout << "\n Grupos VisualStudio C++ UIS";
cout << "\n LAURA RIOS";
cout << "\n ==============================";
}
void limpiaopciones()
{
int i;
linea = 5;
Console::SetCursorPosition(3, linea);
for (i = 1; i <= 20; i = i + 1)
{
cout << " ";
}
Console::ForegroundColor::set(ConsoleColor::White);//letra Blanca
linea = 5;
}
void opciones()
{
Console::ForegroundColor::set(ConsoleColor::Green);//letra Verde
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"APLICACIONES INGENIERIA ");
Console::WriteLine(L"1. BIBLIOTECA UIS ");
Console::WriteLine(L"2. POLITICA NOTICIAS ");
Console::WriteLine(L"3. ING MECANICA");
Console::WriteLine(L"4. ING INDUSTRIAL");
Console::WriteLine(L"5.leer vanguardia liberal");
Console::WriteLine(L"6.facebook");
Console::WriteLine(L"7. cancion");
Console::WriteLine(L"8.video");
Console::WriteLine(L"9.foto");
Console::WriteLine(L"... otras FUNCIONES");
Console::WriteLine(L"10. para TERMINAR ");
cout << "\n\n Digite opcion ";
cin >> op;
limpiaopciones();
}
void bibliotecauis()
{
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"Hola a todos VOY A BIBLIOTECA UIS === > presione
Intro y espere ");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
//getch();
system("explorer http://tangara.uis.edu.co/");
Console::WriteLine(L"... Enter para salir ");
getch();
}
void politica()
{
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" NOTICIAS POLITICA === > presione Intro y espere ");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
getch();
system("explorer http://goo.gl/BqaqT");
getch();
Console::WriteLine(L"Regrese de POLITICA ");
Console::WriteLine(L" Intro pata terminar y/o salirr ");
Console::WriteLine(L"... Enter para salir ");
getch();
}
void ingmecanica()
{
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" VOY A INGENIERIA MECANICA ");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"CONSULTA INGENIERIA MECANICA");
Console::WriteLine(L" Conectar APLICACIÓN === > presione Intro y espere");
getch();
system("explorer https://bit.ly/2tvECI3");
getch();
Console::WriteLine(L" Ir a problemas Ingenieria Mecanica === > presione Intro y
espere ");
getch();
system("explorer https://tinyurl.com/y5wv85yf");
getch();
Console::WriteLine(L"... Enter para salir ");
getch();
}
Void ingindustrial()
{
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" ");
//linea = linea + 1;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"=============================================
========");
Console::WriteLine(L" UIS APLICACIÓNES INGENIERIA INDUSTRIAL ");
Console::WriteLine(L" Estudiantes UIS ing - industrial ");
Console::WriteLine(L"=============================================
===========================");
Console::WriteLine(L" inicia dispositivo(explorer google) y ruta donde estan las
aplicaciones");
Console::WriteLine(L"=============================================
===========================");
Console::WriteLine(L" Conectar APLICACIÓN === > presione Intro y espere ");
getch();
system("explorer https://tinyurl.com/yyax4q6z");
linea = 11;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" ");
getch();
linea = linea + 1;
Console::WriteLine(L" Ir a PROBLEMAS Ingenieria Industrial === > presione
Intro y espere");
getch();
system("explorer https://tinyurl.com/y3275xnp");
linea = 12;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" ");
Console::WriteLine(L"... intro para salir ");
getch();
}
void vanguardia()
{
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"Hola a todos VOY A vanguardia === > presione Intro y
espere ");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
//getch();
system("explorer https://www.vanguardia.com/");
Console::WriteLine(L"... Enter para salir ");
getch();
}
void face()
{
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"Hola a todos VOY A facebook === > presione Intro y
espere ");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
//getch();
system("explorer https://www.facebook.com/");
Console::WriteLine(L"... Enter para salir ");
getch();
}
void cancion1() {
linea = 1;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"Ejecutando");
cout << "Sonando como en el cielo";
system("start mplayer2.exe /play C:/Users/Descargas/cancion.mp3");
getch();
}
void video() {
linea = 1;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"ejecutando");
cout << "Viendo video";
system("start mplayer2.exe /play C:/Users/Descargas/video.mp4");
getch();
}
void imagen() {
linea = 1;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"ejecutando");
cout << "Viendo imagenes";
system(" C:/Users/Estudiante/Downloads/uis.png");
getch();
}
int main()
{
fijo();
do {
opciones();
switch (op)
{
case 1: { bibliotecauis(); limpiaopciones(); break; }
case 2: { politica(); limpiaopciones(); break; }
case 3: { ingmecanica(); limpiaopciones(); break; }
case 4: { ingindustrial(); limpiaopciones(); break; }
case 5: {vanguardia(); limpiaopciones(); break; }
case 6: {face(); limpiaopciones(); break; }
case 7: { cancion1(); limpiaopciones(); break; }
case 8: {video(); limpiaopciones(); break; }
case 9: {imagen(); limpiaopciones(); break; }
// espacios para mas FUNCIONES
}
} while (op != 10); // opcion = 9 Terminar
Console::WriteLine(L"Termina sistema ");
getch();
}
25. CALCULADORA CON LOS 7 EJERCICIOS TIPO
PREVIO
#include "stdafx.h"
#include "iostream"
#include <conio.h>
void fijo()
{
void limpiaopciones()
int i;
linea = 5;
Console::SetCursorPosition(3, linea);
Console::ForegroundColor::set(ConsoleColor::White);//letra Blanca
linea = 9;
void opciones()
Console::ForegroundColor::set(ConsoleColor::Green);//letra Verde
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"3. repetida");
limpiaopciones();
}
void suma() // si j es primo
{
float mayor, n, x, menor;
int co, ci, p, sp, z;
menor = 999999;
sp = 0;
co = 1;
while (co != 0) {
co = z / 10,
ci = co * 10;
p = z - ci;
sp = sp + p;
z = co;
}
cout << "la suma de sus cifras es " << sp << endl;
if (sp < menor) {
menor = sp;
}
}
void repetida()
{
linea = 7;
Console::SetCursorPosition(3, linea);
linea = linea + 2;
Console::SetCursorPosition(3, linea);
float mayor, n, x, menor;
int co, ci, p, sp, a, b, c, d, e, f, g, h, i, j, s, z, za;
co = x / 10,
ci = co * 10;
p = x - ci;
x = co;
if (p == 0) {
a = a + 1;
}
if (p == 1) {
b = b + 1;
}if (p == 2) {
c = c + 1;
}if (p == 3) {
d = d + 1;
}if (p == 4) {
e = e + 1;
}if (p == 5) {
f = f + 1;
}if (p == 6) {
g = g + 1;
}if (p == 7) {
h = h + 1;
}
if (p == 8) {
i = i + 1;
}
if (p == 9) {
j = j + 1;
}
}
if (a >= b&&a >= c&&a >= d&&a >= e&&a >= f&&a >= g&&a >= h&&a
>= i&&a >= j&&a != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 0 " << endl;
}
if (b >= a&&b >= c&&b >= d&&b >= e&&b >= f&&b >= g&&b >= h&&b
>= i&&b >= j&&b != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 1 " << endl;
}
if (c >= b&&c >= a&&c >= d&&c >= e&&c >= f&&c >= g&&c >= h&&c
>= i&&c >= j&&c != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 2 " << endl;
}
if (d >= b&&d >= c&&d >= a&&d >= e&&d >= f&&d >= g&&d >= h&&d
>= i&&d >= j&&d != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 3 " << endl;
}
if (e >= b&&e >= c&&e >= d&&e >= a&&e >= f&&e >= g&&e >= h&&e
>= i&&e >= j&&e != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 4 " << endl;
}
if (f >= b&&f >= c&&f >= d&&f >= e&&f >= a&&f >= g&&f >= h&&f >=
i&&f >= j&&f != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 5" << endl;
}
if (g >= b&&g >= c&&g >= d&&g >= e&&g >= f&&g >= a&&g >= h&&g
>= i&&g >= j&&g != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 6 " << endl;
}
if (h >= b&&h >= c&&h >= d&&h >= e&&h >= f&&h >= g&&h >= a&&h
>= i&&h >= j&&h != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 7 " << endl;
}
if (i >= b&&i >= c&&i >= d&&i >= e&&i >= f&&i >= g&&i >= h&&i >=
a&&i >= j&&i != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 8 " << endl;
}
if (j >= b&&j >= c&&j >= d&&j >= e&&j >= f&&j >= g&&j >= h&&j >=
i&&j >= a&&j != 0)
{
cout << "la cifra mas repetida de " << z << " es: " << " 9 " << endl;
}
sp = 0;
co = 1;
while (co != 0) {
co = z / 10,
ci = co * 10;
p = z - ci;
sp = sp + p;
z = co;
}
cout << "la suma de sus cifras es " << sp << endl;
if (sp < menor) {
menor = sp;
}
}
cout << "LA SUMA DE CIFRAS MENOR ES " << menor << endl;
getch();
}
getch();
cout << "\n\n";
}
void ordene() {
linea = 20;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" de binario a base diez y ordenarlo ");
linea = linea + 1;
Console::SetCursorPosition(4, linea);
int aux;
for (int i = 1; i < na; i = i + 1)
{
for (int j = i + 1; j < na; j = j + 1) {
co = z / 10;
ci = co * 10;
p = z - ci;
f = pow(2, si);
sp[i] = sp[i] + p*f;
z = co;
si = si + 1;
}
cout << "el numero en base 10 es " << sp[i] << endl;
}
ordene();
getch();
}
void parsa() {
int a, b, c, h, ex, rta, i, z, s, t, x, n, f, za;
linea = 15;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" binario del mayor");
linea = linea + 1;
Console::SetCursorPosition(4, linea);
z = mayork;
i = 0;
rta = 0;
ex = log2(z);
a = z;
for (int b = 0; b<ex; b = b + 1) {
if (a % 2 == 1) {
c = pow(10, b);
rta = c + rta;
}
a = a / 2;
t = b + 1;
}
x = pow(10, t);
rta = rta + x;
cout << "el binario de " << z << " es:" << rta << endl;
void primo2() {
float mayor, n, x;
int co, f, ci, p, sp, sa;
mayork = 0;
linea = 7;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" binario ");
linea = linea + 1;
Console::SetCursorPosition(4, linea);
cout << "żcuantos numeros desea ingresar? "; cin >> n;
f = x - 1;
for (int a = 2; a<x; a = a + 1) {
ci = x / a;
sp = ci*a;
if (sp == x) {
cout << " " << x << ", no es primo" << endl;
a = f;
sa = 0;
}
else {
sa = 1;
}
}
if (sa == 1)
{
cout << " " << x << ", es primo " << endl;
if (x>mayork) {
mayork = x;
}
}
}
cout << "el mayor de los primos es: " << mayork;
parsa();
getch();
clave = 1;
fin = j - 1;
co = int(j / k);
pr = co*k;
if (pr == j)
clave = 0;
}
void hacermatriz()
{
Console::ForegroundColor::set(ConsoleColor::Green);//letra Verde
linea = 8;
Console::SetCursorPosition(3, linea);
c1 = 0; // contador mayores de 20
c2 = 0; // contador menores que 20
for (ii = 1; ii <= n; ii = ii + 1)
// iniciar proceso entrar datos
{
cout << " tecle dato " << ii << " = ";
cin >> x;
if (x >= 20)
{
c1 = c1 + 1;
ma[c1] = x; // cada x mayor que 20 y se cuentan
}
else {
c2 = c2 + 1;
m[c2] = x; // cada x menor que 20 va a vector m y se cuentan
}
}
a[ii][jj] = 22;
{
for (jj = 1; jj <= 6; jj = jj + 1) // es de n x 20 columnas
{
if (k <= c1) // para colocar todos los mayores que 20 en a de 6*6
{
a[ii][jj] = ma[k];
k = k + 1;
}
{
cout << a[ii][jj] << " ";
}
cout << "\n";
}
void factorial() // Calculo del factorial de cada numero j que fue primo
int ii;
facj = 1;
facj = facj*ii;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"Teclee n = a ");
for (i = 1; i <= n; i = i + 1)
a[i][j] = 0;
for (i = 1; i <= n; i = i + 1)
{
Console::SetCursorPosition(3, linea);
linea = linea + 1;
cout << " tecle dato " << i << " = ";
cin >> x;
}
for (i = 1; i <= n; i = i + 1) // trabajar cada numero de los n numeroso
factorial();
if (a[i][j] > 0)
getch();
void trigo()
{
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L" seno cos tan cot ");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
float x, a, rad, n, m, sen, cas, ton, cot, sic, csca, sent, cost;
if (cas == 0) {
cout << "tangente tiende a infinito" << endl;
cout << "secante tiende a infinito" << endl;
}
else {
ton = sen / cas;
cout << "tangente es igual a: " << ton << endl;
sic = 1 / cas;
cout << "secante es igual a: " << sic << endl;
}
if (sen == 0) {
cout << "cotangente tiende a infinito" << endl;
cout << "cosecante tiende a infinito" << endl;
}
else {
cot = cas / sen;
cout << "cotangente es igual a: " << cot << endl;
csca = 1 / sen;
cout << "cosecante es igual a: " << csca << endl;
}
float sx, e, d, sig, t, s, fd;
sx = 0;
e = 1;
d = 1;
sig = 1;
fd = fd * s;
}
float resultado = pow(rad, e);
sx = sx + (sig*(resultado / fd));
e = e + 2;
d = d + 2;
sig = -1 * sig;
}
cout << "el seno por taylor es igual a: " << sx << endl;
sx = 1;
e = 2;
d = 2;
sig = -1;
fd = fd * s;
}
float resultado = pow(rad, e);
sx = sx + (sig*(resultado / fd));
e = e + 2;
d = d + 2;
sig = -1 * sig;
}
cout << "el coseno por taylor es igual a: " << sx << endl;
}
getch();
}
void contar() {
linea = 15;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"pares del mayor, multiplos de tres del menor");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
int co, ci, p, sp, a, z, y;
sp = 0;
co = 1;
a = 0;
z = mayorz;
y = menorz;
while (co != 0) {
co = mayorz / 10,
ci = co * 10;
p = mayorz - ci;
if (p % 2 == 0)
{
a = a + 1;
}
mayorz = co;
}
cout << "el numero de cifras pares es de " << z << " es: " << a << endl;
sp = 0;
co = 1;
a = 0;
while (co != 0) {
co = menorz / 10,
ci = co * 10;
p = menorz - ci;
if (p % 3 == 0)
{
a = a + 1;
}
menorz = co;
}
cout << "el numero de cifras multiplos de 3 de " << y << " es: " << a << endl;
}
void mayorm() {
float mayor, n, x, menor;
int co, ci, p, a, z, y;
linea = 5;
Console::SetCursorPosition(3, linea);
Console::WriteLine(L"hallar el mayor y el menor decir cuantas cifras con pares o
multiplos de tres");
linea = linea + 1;
Console::SetCursorPosition(3, linea);
cout << "¿cuantos numeros desea ingresar? "; cin >> n;
mayorz = -1000000000;
menorz = 999999999;
for (int i = 1; i <= n; i = i + 1) {
cout << "INGRESAR LOS NUMEROS "; cin >> x;
if (x>mayorz) {
mayorz = x;
}
if (x<menorz) {
menorz = x;
}
}
cout << "EL NUMERO MAYOR ES " << mayorz << endl;
cout << "EL NUMERO MENOR ES " << menorz << endl;
contar();
getch();
}
int main()
{
fijo();
do {
opciones();
switch (op)
getch();
}