0% encontró este documento útil (0 votos)
20 vistas22 páginas

Programas de C++ (Isves)

Derechos de autor
© Attribution Non-Commercial (BY-NC)
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como DOCX, PDF, TXT o lee en línea desde Scribd
0% encontró este documento útil (0 votos)
20 vistas22 páginas

Programas de C++ (Isves)

Derechos de autor
© Attribution Non-Commercial (BY-NC)
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como DOCX, PDF, TXT o lee en línea desde Scribd
Está en la página 1/ 22

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE

PROGRAMAS

DE

C++

ALUMNO: DARWIN ANDRES ISVES VARGAS

LCDO: VINICIO MURILLO CURSO: 5to APLICACIONES

AO LECTIVO: 2011-2012

1) ELABORE UN PROGRAMA QUE PERMITA EL INGRESO DE UN NUMERO, CALCULAR EL CUBO


# include<stdio.h> # include<conio.h> main() { float cubo, num;

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


clrscr(); printf(ingrese un numero:); scanf(%f, &n); cubo= num* num* num*; printf(el cubo de %2f es: %2f, num, cubo); getch(); }

2) ELABORE UN PROGRAMA QUE PERMITA CALCULAR EL AREA DE UN ROMBO.


# include<stdio.h> # include<conio.h> main() { float area d1, d2; clrscr(); printf(area de un rombo); printf(ingrese el valor d1:); printf(ingrese el valor d2:); scanf(%f, &d1, &d2); area= (d1*d2) / 2 printf(la respuesta es: %f, area); getch();

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


}

3) ELABORE UN PROGRAMA QUE PERMITA CALCULAR EL AREA DE UN TRAPECIO.


# include<stdio.h> # include<conio.h> main() { float area, b1, b2, h; clrscr(); printf(ingrese el valor de b1:); printf(ingrese el valor de b2:); printf(ingrese el valor de la altura:); scanf(%f, &b1, &b2, &h); area= (b1 + b2)*h /2; printf(la respuesta es: %f, area); getch(); }

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE

4) ELABORE UN PROGRAMA QUE CALCULE LA COMISION QUE DEBE RECIBIR UN VENDEDOR, SEGN LA VENTA QUE HAYA REALIZADO. SI LA VENTA ES MAYOR A $500, EL VENDEDOR DEBE RECIBIR EL 15% DEL TOTAL DE LA VENTA; CASO CONTRARIO NO HAY COMISION.
#include<stdio.h> #include<conio.h> main() { float ventot, comision; clrscr(); printf(ingrese la venta total:); scanf(%f,&ventot); if(ventot>500); { comisin=ventot*0.15; } printf(el vendedor debe recibir: %2f, comisin); getch(); }

5) ELABORE UN PROGRAMA QUE CALCULE LA COMISION QUE DEBE RECIBIR UN VENDEDOR. SI LA VENTA ES MAYOR A $500 EL VENDEDOR DEBE RECIBIR EL 15% DEL TOTAL DE LA VENTA; CASO CONTRARIO, ES DECIR SI LA VENTA ES MENOR O IGUAL QUE $500 DEBE RECIBIR EL %5
#include<stdio.h> #include<conio.h>

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


main() { float ventot, comision; clrscr(); printf(calculo de comision \n); printf(ingrese la venta total:); scanf(%f,&ventot); if(ventot>500){ comisin=ventot*0.15; } else { comisin=ventot*0.05; } printf(el vendedor debe recibir: %2f, comisin); getch(); }

6) ELABORE UN PROGRAMA QUE PERMITA EL INGRESO DE UN NUMERO SI ES POSITIVO O NEGATIVO


#include<stdio.h> #include<conio.h> main() { int num; clrscr(); printf(ingrese un numero:); scanf(%d,&num); if(num>=0){ printf(numero positive); }

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


else { printf(numero negative); } getch(); }

7) UNA TIENDA DE ARTEFACTOS ELECTRICOS PONE EN VIGENCIA EL SIGUIENTE PLAN PARA INCREMENTAR SUS VENTAS
SI LA COMPRA ES >100 >200 >250 <250 #include<stdio.h> #include<conio.h> main() { float ventot,descuento; clrscr(); printf(calculo de la venta\n); printf(ingrese la venta total:); scanf(%2f,&ventot); if(ventot<100) descuento=ventot*0.05; else if(ventot<200) descuento=ventot*0.08; else if(ventot<250) descuento=ventot*0.12; DESCONTAR EL 5% 8% 12% 15%

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


else if(ventot>250) descuento=ventot*0.15; descuento=ventot-descuento; printf(la venta total a pagar es: %2f, descuento); getch(); }

8) ELABORE UN PROGRAMA QUE DETERMINE EL MAYOR DE DOS NUMEROS


#include<stdio.h> #include<conio.h> main()

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


{ int a,b,max; clrscr(); printf(ingrese un numero:); scanf(%d,&a); printf(ingrese otro numero:); scanf(%d,&b); max=(a>b)? a:b; printf(el mayor es: %d,max); getch(); }

9) VEAMOS UN PROGRAMA QUE SOLICITA LA NOTA OBTENIDA POR

UN ESTUDIANTE EN LA SUMATORIA. SI LA NOTA ES MAYOR O IGUAL QUE 40 MUESTRA EL MENOR APROBADO, CASO CONTRARIO MUESTRA SUPLETORIO.
#include<stdio.h> #include<conio.h> main() { float nota; printf(ingrese la nota obtenida:); scanf(%f,&nota); if(nota>=40) printf(aprobado); else printf(reprobado);

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


getch(); }

10)VEAMOS UN EJEMPLO DE MULTIPLES CASOS CON LA ESTRUCTURA SWITCH


#include<stdio.h> #include<conio.h> main() { int opcion; float base,altura,lado,d1,d2; clrscr(); printf(calculo de areas\n); printf(1.rectangulo\n); printf(2.cuadrado\n); printf(3.rombo\n) printf(elija una opcin:); scanf(%d,&opcion); clrscr(); switch(opcin){ case 1: printf(area del rectngulo); printf(ingrese la base:); scanf(%f,&base); printf(ingrese la altura:); scanf(%f,&altura); printf(el area del rectngulo es: %2f,base*altura);

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


break; case 2: printf(area del cuadrado); printf(ingrese uno de los lados:); scanf(%f,&lado); printf(el area del cuadrado es: %2f, lado*lado); break; case 3: printf(area del rombo); printf(ingrese la diagonal 1:); scanf(%f,&d1); printf(ingrese la diagonal 2:); scanf(%f,&d2); printf(el area del rombo es: %2f, d1*d2/2); break; default: printf(elija una numero entre 1 y 3); break; } getch(); }

11)BOLETA DE PAGO

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE PROGRAMA PARA OBTENER EL SALARIO NETO Y LA RETENCION DE UN EMPLEADO. EL CLCULO DE LA RETENCION SE BASA EN LAS CONDICIONES SIGUIENTES:
SI SI SI 0 < SALARIO 3000 <= SALARIO <=1500 RETENCION O% 5% 1500 <=SALARIO <=3000 RETENCION RETENCION 8%

#include<stdio.h> #include<conio.h> main() { char nombre[30]; float salario,reten,salneto; clrscr(); printf(ingrese datos del empleado\n); printf(__________________\n); printf(nombre:); gest (nombre); printf(salario:); scanf(%f,&salario); printf(__________________\n); if(salario>=1500) if(salario<=3000) reten=salario*0.05; else reten=salario*0.08; } else reten=0; salneto=salario-reten; printf(\n); printf(_______________\n); printf(boleta de pago\n); printf(nombre printf(salario :%10s\n,nombre); :%10.2f\n,salario);

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


printf(retencin :%10.2f\n,reten);

printf(salario neto: %10.2f\n,salneto); printf(________________\n); getch(); }

12)ELABORE UN PROGRAMA PARA CALCULAR LA SUMA DE LOS NUMEROS N, UTILIZANDO LA ESTRUCTURA WHILE
#include<stdio.h> #include<conio.h> main() { int x,n,suma; clrscr(); printf(ingrese un numero entero:); scanf(%d,&n); suma=0; x=1; while(x<=n){ //acumula la suma de los nmeros 1,2,3 ,n suma=suma+x; //genera los nmeros 1,2,3,n x=x+1; }

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


printf(la suma de los nmeros es: %ld, suma); printf(pulse cualquiera de laa teclas); getch(); }

13)CALCULAR EL FACTORIAL DE UN NUMERO


#include<stdio.h> #include<conio.h> main() { int n,x; float fact=1; clrscr(); printf(ingrese un numero entero:); scanf(%d,&n); x=n; while(x>0){ fact=fact*x; x=x-1; } printf(el factorial de %d es: %f, n, fact); getch(); }

14)ELABORE UN PROGRAMA QUE CALCULE EL PRODUCTO DE DOS NUMEROS MEDIANTE SUMAS SIN UTILIZAR EL OPERADOR(*)
#include<stdio.h>

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


#include<conio.h> main() { long int a,b,prod; clrscr(); printf(product de los numerous positives\n); printf(ingrese primer factor:); scanf(%ld,&a); printf(ingrese Segundo factor:); scanf(%ld,&b); prod=0; do{ prod=prod+a; b=b+1; }while(b>0); printf(el producto es: %ld\n, prod); getch(); }

15)ELABORAR UN PROGRAMA QUE SOLICITA EL CAPITAL INICIAL


m=c(1+i n)n*t m= capital final o monto c= capital inicial i= tipo de inters nominal n= numero de periodos por aos t= numero de aos #include<stdio.h> #include<conio.h> main()

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


{ float m,c,I; int n,t; clrscr(); gotoxy (6,2); printf(calculo del capital final o monto); gotoxy (17,3); printf(capital inicial:); scanf(%f,&c); gotoxy (17,4); printf(interes nominal:); scanf(%f,&i); gotoxy (6,5); printf(numero de periodos:); scanf(%d,&n); gotoxy (18,6); printf(numer de aos:); scanf(%d,&t); i=i/100; m=c*pow(1+2/n,n*t); gotoxy (19,7); printf(capital final: %2f, m); gotoxy (6,8); printf(pulse cualquier tecla); getch(); }

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE

16)ELABORAR UN PROGRAMA QUE PERIMITA CALCULAR EL CAPITAL INICIAL


/*programa: capini.c*/ #include<stdio.h> #include<conio.h> #include<math.h> main() { float m,c,I; int n,t; clrscr(); gotoxy (6,2); printf(calculo del capital inicial); gotoxy (19,3); printf(capital final:); scanf(%f,&m); gotoxy (17,4); printf(interes nominal:); scanf(%f,&i); gotoxy (6,5); printf(numero de periodos por ao:); scanf(%d,&n); gotoxy (18,6); printf(numero de aos:); scanf(%d,&t); i=i/100; c=m/pow(1+i/n,n*t); gotoxy (17,7); printf(capital inicial: %2f, c); gotoxy (6,8); printf(pulse cualquier tecla.); getch(); }

17)ELABORAR UN PROGRAMA QUE CALCULE EL NUMERO DE AOS


/*programa: caltiemp.c*/

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


#include<stdio.h> #include<conio.h> #include<math.h> main() { float m,c,I; int n,t; clrscr(); gotoxy (6,2); printf(calculo de numero de aos); gotoxy (17,3); printf(capital inicial:); scanf(%f,&c); gotoxy (19,4); printf(capital final:); scanf(%f,&m); gotoxy (17,5); printf(tasa de interes:); scanf(%f,&i); gotoxy (6,6); printf(numero de periodos por ao:); scanf(%d,&n); i=i/100; t=(l0g(m)-log(c))/(n*log(1+i/n)); gotoxy (18,7); printf(numero de aos: %2d, t); gotoxy (6,8); printf(pulse cualquier tecla.); getch(); }

18)ELABORAR UN PROGRAMA QUE SOLICITE EL INGRESO DE UN CARCTER EN MINUSCULA Y LO CONVIERTA EN MAYUSCULA


#include<stdio.h> #include<conio.h> char mayus (char); main() { char c; clrscr() printf(ingrese un caracter:); scanf(%c,&c); printf(convertido en mayuscula: %c, mayus(c));

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


getch(); } char mayus (char c) { /*convierte un carcter a mayscula*/ char r; r= (c>=a&&c<=z)?A+(c-a):c; return r; }

19)AMORTIZACION DE UNA DEUDA CON ANUALIDADES VENCIDAS


A= pago al final de cada periodo C= deuda a amortizar I= tipo de inters anual T= nmero de aos /*programa: amort.c*/ #include<stdio.h> #include<conio.h> #include<math.h> void reporte(float c, float i, int t, int p); main() { float c, i; int t, p; clrscr(); gotoxy (6,2); printf(AMORTIZACION DE UNA DEUDA); gotoxy (6,3); printf(deuda a amortizar:); scanf(%f,&c); gotoxy (6,4); printf(tipo de interes annual:); scanf(%f,&i);

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


gotoxy (6,5); printf(tiempo en aos:); scanf(%d,&t); gotoxy (6,6); printf(periodo amortizacion:); scanf(%d,&p); i=i/100; reporte(c,i,t,p); } void reporte(float c, float i, int t, int p) { float amort, inters, cp, si=0, sa=0, scp=0; int k=1, f=4; clrscr(); gotoxy (22,2); printf(TABLA DE AMORTIZACION); gotoxy (6,3); printf(periodo capital pagado); while(k <=t*p){ inters=c*i/p; cp=amort-inters; gotoxy (6,f); printf(%2d %12.2f %10.2f %10.2f %10.2f,k,c,inters,amort,cp); c=c-cp; si=si+inters; sa=sa+amort; scp=scp+cp; f=f+1; if(f==22){ gotoxy (6,f); printf(pulse cualquier tecla..); f=4; clrscr(); } K=k+1; } gotoxy (12,f); printf(totales: %10.2f %10.2f %10.2f, si, sa, scp); inters pago capital

amort=c*(i/p)*pow(1+i/p,t*p)/(pow(1+i/p,t*p)-1);

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


gotoxy (6,f+1); printf(pulse cualquier tecla); getch(); }

20)CALCULAR LA HIPOTENUSA DE UN TRIANGULO RECTANGULO


#include<stdio.h> #include<conio.h> #include<math.h> main() { float a, b, h; clrscr(); printf(ingrese el lado a:); scanf(%f,&a); printf(ingrese el lado b:); scanf(%f,&b);

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


h=hypot(a,b); printf(la hipotenusa es: %2f,h); getch(); }

21)CALCULO DE LA POTENCIA DE UN NUMERO


#include<stidio.h> #include<conio.h> #include<math.h> float potencia (float x, float y); main () { float x,y,p; clrscr(); printf(potencia de un numero\n); printf(ingrese la base:); scanf(%f,&x); printf(ingrese el exponente:); scanf(%f,&y); p=potencia(x,y); printf(la potencia es: %2f,p); getch(); float potencia (float x, float y) { return exp (y*log(x));

NOMBRE: DARWIN ANDRES ISVES VARGAS

COLEGIO FISCAL MIXTO QUINCE DE OCTUBRE


}

22)CALCULAR EL SENO DE UN ANGULO EN RADIANES


#include<math.h> #include<stdio.h> #include<conio.h> #define pi 3,1416 main() { float a, b, area, sexa, radianes; clrscr(); printf(area de un triangulo\n); printf(ingrese el lado a:); scanf(%f,&a); printf(ingrese el lado b:); scanf(%f,&b); printf(ingrese el angulo en sexagesimal:); scanf(%f,&sexa); radianes=pi*sexa/180; //conversin de sexagesimal a radianes area=a*b*sin(radianes)/2; printf(area del triangulo: %2f,area); getch(); }

NOMBRE: DARWIN ANDRES ISVES VARGAS

También podría gustarte