Documentos de Académico
Documentos de Profesional
Documentos de Cultura
#include<iostream> #include<stdlib.h>
//inicio
int main() {
int opcion;
scanf("%i",&opcion);
if(opcion>4) {
} else{
int valor1,valor2,suma;
suma=valor1+valor2;
} switch(opcion){
case 2:{
int valor1,valor2,restar;
restar=valor1-valor2;
switch(opcion){
multiplicar=valor1*valor2;
if (valor2!=0){
dividir=valor1/valor2;
return 0; }
// inicio
descuento=(total*15)/100;
pagar=total-descuento;
getche();
// fin
// inicio
main(){
int numero1,numero2,resultado;
getche();
// fin
#include<stdio.h> #include<conio.h>
int main() {
float sueldo,total; int i,horas; for (i=0; i<5; i++ ) { printf("\n horas trabajadas: "); scanf("%i",&horas); total= horas*4;
printf("sueldo: %.2f",total);
system ("pause");
} }
#include <stdio.h> int main() {float d, t, Vm; printf("el carro a recorrido una distancia: "); scanf("%f",&d); printf("el tiempo que tardo: "); scanf("%f",&t); Vm= d/t; printf("su velocidad media es: %f\n", Vm); return 0; }
#include <stdio.h> int main() {float entero1,digito; printf("ingrese entero1: "); scanf("%f",&entero); digito= un caracter; printf("el ultimo caracteter es: %f\n"digito); return 0; }
class fecha{ private: int dia, mes, anho; public: void asignar(int d, int m, int a); void mostrar(); void anterior(); };
void fecha::mostrar(){ cout << dia << "/" << mes; cout << "/" << anho;
};
void fecha::anterior() {
else { if(dia==1 && mes==3) dia=28; mes=mes-1; } else if (dia==1 && (mes==2 or mes==4 or mes==6 or mes==8 or mes==9 or mes==11)) dia=31; mes=mes-1; } else {
int main (){ fecha f; f.asignar(28,2,2010); f.anterior(); f.mostrar(); system ("PAUSE"); return 0;
/* suma de pares he impares*/ #include <stdio.h> main() { int suma=0, i=1, n=0; printf(".\n suma %d.\n\n");
if (n%2==1) printf(".\n impares %d.\n\n", n); n++; suma= n+1; printf(".\n suma total %d.\n\n", suma); } }
#include <stdio.h> int main () { int h; printf ("introduzca una hora (1-24)");
scanf ("%d",&h); if(h<1 || h>24) { printf ("valor no valido"); return 0; } if(h>=18 && h<=24) printf ("buenas noches\n"); if (h>=1 && h<12) printf ("buenos dias\n"); if(h>12 && h<18) printf ("buenas tardes\n"); return 0; }
# include <stdio.h> int opc, numpc; float dist, aux; main() { printf("*******************MENU DE OPCIONES:****************** \n"); printf("1 - SI LA RED ESTA COMPUESTA POR HASTA 2 COMPUTADORAS: \n"); printf("2 - SI LA RED ESTA COMPUESTA DE 2 HASTA 20 COMPUTADORAS : \n");
printf("3 - SI LA RED ESTA COMPUESTA POR MAS DE 20 COMPUTADORAS : \n"); printf("*******************ELIJA LA OPCION:**********************"); scanf("%d", &opc);
switch (opc) { case1: printf("INSERTE EL NUMERO DE COMPUTADORAS: "); scanf("%d", &numpc); printf("AHORA INDIQUE LA DISTANCIA DE C/U DE LAS COMPUTADORAS: "); scanf("%f", &dist);
case2: printf("INSERTE EL NUMERO DE COMPUTADORAS: "); scanf("%d", &numpc); printf("AHORA INDIQUE LA DISTANCIA DE C/U DE LAS COMPUTADORAS: "); scanf("%f", &dist);
if(numpc > 2)
case3: printf("INSERTE EL NUMERO DE COMPUTADORAS: "); scanf("%d", &numpc); printf("AHORA INDIQUE LA DISTANCIA DE C/U DE LAS COMPUTADORAS: "); scanf("%f", &dist);
printf ("ingrese fecha formato dd mm aaaa"); scanf("%d %d %d",&d,&m,&a); if (a < 1000 || a > 9999) { printf("Error el ao es invalido"); return 0; } else if (m<1 || m>12) { printf("error el ao es invalido"); return 0; } else
{switch (m)
if (d<1 || d>31 )
return 0; } break;
case 2:
if (d<1 || d>28) {}
default:
d=d+1;
{switch (m)
if (d>31 )
{ d=1; m+=1;
if(m>12)
{m=1;
a+=1;}
break;
case 2:
if (d>28)
{ d=1; m+=1;}
break;
default:
if (d>30)
{d=1; m+=1;}
return 0;
}}
#include<iostream> #include<stdlib.h>
//inicio
int main() {
int opcion;
scanf("%i",&opcion);
if(opcion>4) {
} else{
int valor1,valor2,suma;
suma=valor1+valor2;
} } switch(opcion){
case 2:{
int valor1,valor2,restar;
restar=valor1-valor2;
switch(opcion){
multiplicar=valor1*valor2;
if (valor2!=0){
dividir=valor1/valor2;
return 0; }