Documentos de Académico
Documentos de Profesional
Documentos de Cultura
using std::cout;
using std::cin;
using std::endl;
int main ()
{
float PES;
float DOL;
float TC;
DOL = PES/TC;
cout << "la cantidad de dolares que tiene es: " << DOL << endl;
system("pause");
return 0;
using std::cout;
using std::cin;
using std::endl;
int main ()
{
float NU;
cout << "ESCRIBA UN NUMERO\n";
cin >> NU;
if (NU<0){
NU = (-1)*NU;
cout << "EL VALOR ABSULUTO DE SU MNERO ES: " << NU <<
endl;
}
else {
cout << "EL VALOR ABSOLUTO DE SU NUMERO ES: " << NU <<
endl;
}
system("pause");
return 0;
}
3. //La presión, el volumen y la temperatura de una masa de aire se
relacionan por la formula: masa = (presión * volumen)/(0.37 *
(temperatura + 460))//
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
float PR;
float VL;
float TM;
float MS;
int op;
switch(op)
{
case 1:
cout << "PARA CALCULAR LA MASA DE AIRE\n";
cout << "INGRESE LA PRESION ";
cin >> PR;
cout << "INGRESE EL VOLUMEN ";
cin >> VL;
cout << "INGRESE LA TEMPERATURA ";
cin >> TM;
MS=(PR*VL)/(0.37*(TM+460));
case 2:
cout << "PARA CALCULAR LA TEMPERATURA DE AIRE\n";
cout << "INGRESE LA PRESION ";
cin >> PR;
cout << "INGRESE EL VOLUMEN ";
cin >> VL;
cout << "INGRESE LA MASA ";
cin >> MS;
TM=((PR*VL)/(0.37*MS))-460;
case 3:
cout << "PARA CALCULAR EL VOLUMEN DE AIRE\n";
cout << "INGRESE LA PRESION ";
cin >> PR;
cout << "INGRESE LA MASA ";
cin >> MS;
cout << "INGRESE LA TEMPERATURA ";
cin >> TM;
VL=(MS*0.37*(TM+460))/PR;
case 4:
cout << "PARA CALCULAR LA PRESION DE AIRE\n";
cout << "INGRESE LA MASA ";
cin >> MS;
cout << "INGRESE EL VOLUMEN ";
cin >> VL;
cout << "INGRESE LA TEMPERATURA ";
cin >> TM;
PR=(0.37*MS*(TM+460))/VL;
default:
cout << "EL NUMERO QUE DIGITO NO ES UNA
OPCION\n";
}
system("pause");
return 0;
}
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
int ED;
float NP;
cout << "ESCRIBA SU EDAD\n";
cin >> ED;
NP=(220-ED)/10;
cout << "EL NUEMRO DE PULSACIONES QUE USTED DEBE TENER POR CADA
10 SEGUNDOS DE EJERCICIO ES: " << NP << endl;
system("pause");
return 0;
using std::cout;
using std::cin;
using std::endl;
int main ()
{
float SA;
float NS;
NS=(SA*0.25)+SA;
cout << "El nuevo salario del obrero es: $" << NS << endl;
system("pause");
return 0;
6. #include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
float PRE;
float GIN;
float TRA;
float PED;
cout << "ESCRIBA EL PRESUPUESTO ANUAL DEL HOSPITAL\n";
cin >> PRE;
GIN=PRE*0.4;
TRA=PRE*0.3;
PED=PRE*0.3;
system("pause");
return 0;
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
float CM;
float VT;
VT=(CM*0.3)+CM;
cout << "USTED DEBERIA VENDER ESTE ARTICULO A $" << VT << endl;
system("pause");
return 0;
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
float LU;
float MR;
float VR;
float PRO;
PRO=(LU+MR+VR)/3;
cout <<"EL PROMEDIO DE ESTA SEMANA ES DE: " << PRO << "
MINUTOS." << endl;
system("pause");
return 0;
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
#include <string>
using std::string;
int main ()
{
float I1;
float I2;
float I3;
float TOT;
float P1;
float P2;
float P3;
string N1;
string N2;
string N3;
TOT=I1+I2+I3;
P1= (I1*100)/TOT;
P2= (I2*100)/TOT;
P3= (I3*100)/TOT;
cout << N1 << " INVIRTIO " << P1 << "%" << endl;
cout << N2 << " INVIRTIO " << P2 << "%" << endl;
cout << N3 << " INVIRTIO " << P3 << "%" << endl;
system("pause");
return 0;
}
10. #include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
float PC;
float TC1;
float TC2;
float TC3;
float PTC;
float PROM;
float PP;
float TP1;
float TP2;
float PTP;
float PI;
float TI1;
float TI2;
float TI3;
float PTI;
float PF1;
float TF1;
float PF2;
float TF2;
float PF3;
float TF3;
float PFF;
float TFF;
float ACU=0;
float PG;
int mat;
for(mat=0; mat <=4; mat++)
{
switch(mat)
{
case 1:
cout << "MATERIA: CALCULO\n";
cout << "nota del parcial de
calculo: ";
cin >> PC;
cout << "nota del primer trabajo de
calculo: ";
cin >> TC1;
cout << "nota del segundo trabajo de
calculo: ";
cin >> TC2;
cout << "nota del tercer trabajo de
calculo: ";
cin >> TC3;
PTC=(TC1+TC2+TC3)/3;
PROM= (PTC*0.1)+(PC*0.9);
cout << "NOTA PROMEDIO DE CALCULO: "
<< PROM << endl;
break;
case 2:
cout << "MATERIA: PROGRAMACION\n";
cout << "nota del parcial de
programacion: ";
cin >> PP;
cout << "nota del primer trabajo de
programacion: ";
cin >> TP1;
cout << "nota del segundo trabajo de
programacion: ";
cin >> TP2;
PTP=(TP1+TP2)/2;
PROM= (PP*0.8)+(PTP*0.2);
cout << "NOTA PROMEDIO DE
PROGRAMACION: " << PROM << endl;
break;
case 3:
cout << "MATERIA: INTROD. A LA
INGENIERIA\n";
cout << "nota del parcial de
introduccion: ";
cin >> PI;
cout << "nota del primer trabajo de
introduccion: ";
cin >> TI1;
cout << "nota del segundo trabajo de
introduccion: ";
cin >> TI2;
cout << "nota del tercer trabajo de
introduccion: ";
cin >> TI3;
PTI=(TI1+TI2+TI3)/3;
PROM=(PI*0.85)+(PTI*0.15);
cout << "NOTA PROMEDIO DE INT. A LA
INGENIERIA: " << PROM << endl;
break;
case 4:
cout << "MATERIA: FISICA\n";
cout << "nota del primer parcial de
fisica: ";
cin >> PF1;
cout << "nota del trabajo del
parcial: ";
cin >> TF1;
cout << "nota del segundo parcial de
fisica: ";
cin >> PF2;
cout << "nota del trabajo del
parcial: ";
cin >> TF2;
cout << "nota del tercer parcial de
fisica: ";
cin >> PF3;
cout << "nota del trabajo del
parcial: ";
cin >> TF3;
cout << "nota del parcial final de
fisica: ";
cin >> PFF;
cout << "nota de los trabajos: ";
cin >> TFF;
PROM= (PF1*0.15)+(TF1*0.05)+
(PF2*0.15)+(TF2*0.05)+(PF3*0.2)+(TF3*0.1)+(PFF*0.2)+(TFF*0.1);
cout << "NOTA PROMEDIO DE FISICA: "
<< PROM << endl;
break;
}
ACU=ACU+PROM;
}
PG=ACU/4;
cout << "EL PROMEDIO GENERAL ES: " << PG << endl;
system("pause");
return 0;
UTILIZANDO EL SI
1. #include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
int NL;
float VL;
if (NL<5) {
VL=NL*800;
cout << "EL VALOR DE LAS LLANTAS ES: " << VL << endl;
}
if (NL>=5) {
VL=NL*700;
cout << "EL VALOR DE LAS LLANTAS ES: " << VL <<
endl;
}
system("pause");
return 0;
}
2. #include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
int N;
float Co;
system("pause");
return 0;
3. #include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
int SE;
int ED;
float PL;
if (SE==1) {
cout << "Escriba su edad: ";
cin >> ED;
PL= (210- ED)/10;
cout << "El numero de pulsaciones por cada 10
segundos de aerobicos para usted debe ser:\n"
<< PL << endl;
}
if (SE==2) {
cout << "Escriba su edad: ";
cin >> ED;
PL= (220- ED)/10;
cout << "El numero de pulsaciones por cada 10
segundos de aerobicos para usted debe ser:\n"
<< PL << endl;
}
system("pause");
return 0;
4. #include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
float PR;
float CU;
if (PR<500000) {
CU=PR*0.03;
cout << "La cuota a pagar es: " << CU << endl;
}
else {
CU=PR*0.02;
cout << "La cuota a pagar es: " << CU << endl;
}
system("pause");
return 0;
}
5. #include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
int NM;
float Pr;
float PR;
float TOT;
system("pause");
return 0;
}
6. #include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
float SA;
float VC;
float PC;
float RST;
if (SA<8000) {
PC=VC*0.15;
cout << "La primera cuota que debera pagar es
de: $" << PC << endl;
RST=(VC-PC)/120;
cout << "Usted seguira pagando cuotas mensuales
de: $" << RST << " Hasta que termine de cubrir la deuda" << endl;
}
else {
PC=VC*0.3;
cout << "La primera cuota que debera pagar es de: $" << PC
<< endl;
RST=(VC-PC)/84;
cout << "Usted seguira pagando cuotas mensuales de: $" <<
RST << " Hasta que termine de cubrir la deuda" << endl;
}
system("pause");
return 0;
}
7. #include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
float SA;
float POR;
float SAR;
float REST;
SAR=(SA*POR)/100;
REST=SA-SAR;
cout << "EL Dinero que mensualmente sera depositado en SAR es:
$" << SAR << endl;
cout << "El dinero que recibira mensualmente es: $" << REST <<
endl;
system("pause");
return 0;
}
8. #include <iostream>
if (hipoteca<1000000)
{
i2=i/2;
cout<<"la inversion de cada socio es de:"<<i2<<"$"<<endl;
}
else
{ i2=(hipoteca-i)/2;
cout<<"la inversion de cada socio es
de:"<<i2<<"$"<<endl; }
return 0;
}
UTILIZANDO EL SI ANIDADO
1. #include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
int LL;
float VL;
float DS;
cout << "El valor que se le cobrara es de : $" << DS << endl;
system("pause");
return 0;
}
2. #include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
int CL;
float PL;
if (CL<5){
PL=CL*300;
cout << "Cada llanta le cuesta $300\n";
}
else if (CL>=5 && CL<=10) {
PL=CL*250;
cout << "Cada llanta le cuesta $250\n";
}
else if (CL>10){
PL=CL*200;
cout << "Cada llanta le cuesta $200\n";
}
cout << "EL PRECIO TOTAL DE LA COMPRA ES: $" << PL << endl;
system("pause");
return 0;
}
3. #include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
int PP;
int SP;
int TP;
system("pause");
return 0;
}
4. #ifdef __MSDOS__
#include <iostream.h>
#include <stdlib.h>
#else
#include <iostream>
#include <cstdlib>
using namespace std;
#endif
int main (void)
{
int marca;
float IVA, descuento, pago, precio_sin_IVA;
cout << "Ingresa el valor de precio sin IVA: ";
cin >> precio_sin_IVA;
cin.get();
cout << "Selecciona el valor de marca." << endl;
cout << "\t1.- AOC" << endl;
cout << "\t2.- Daewoo" << endl;
cout << "\t3.- Fisher" << endl;
cout << "\t4.- GE" << endl;
cout << "\t: ";
do {
cin >> marca;
cin.get();
if (marca<1||marca>10)
{
cout << "Valor incorrecto. Ingr\202salo nuevamente.: ";
}
} while (marca<1||marca>10);
descuento=0;
if(precio_sin_IVA>2000)
descuento=descuento+precio_sin_IVA*0.1;
if(marca==5)
descuento=descuento+precio_sin_IVA*0.05;
IVA=(precio_sin_IVA-descuento)*0.16;
pago=precio_sin_IVA-descuento+IVA;
cout << "Valor de IVA: " << IVA << endl;
cout << "Valor de descuento: " << descuento << endl;
cout << "Valor de pago: " << pago << endl;
cout << endl;
return 0;
}
5. #include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main ()
{
float N1;
float N2;
float N3;
system("pause");
return 0;
}
UTLIZANDO EL FOR (PARA)
1. #include<stdio.h>
void main()
float peso;
int n=0,j=0,a=0,v=0;
float promn,promj,proma,promv;
scanf("%f",&peso);
scanf("%d",&edad);
if (edad>0 && edad<=12)
n++;
j++;
a++;
else
viejos=viejos+ peso;
v++;
promn=ninos/n;
promj=jovenes/j;
proma=adultos/a;
promv=viejos/v;
2. #include <iostream>
using namespace std;
int main()
{
int kilos;
float total, suma = 0.0f;
for (int i = 1; i <= 15; i++)
{
cout << "Kilos cliente " << i << ": ";
cin >> kilos;
total = 10.0f * kilos;
if (kilos > 10)
total -= (10.0f * kilos * 0.15);
cout << "\nA pagar: " << total << endl << endl;
suma += total;
}
cout << "\nTotal ventas: " << suma << endl;
return 0;
}
3. #ifdef __MSDOS__
#include <iostream.h>
#include <stdlib.h>
#else
#include <iostream>
#include <cstdlib>
using namespace std;
#endif
int main (void)
{
int i, mas_contaminante, menos_contaminante, puntos_contaminantes;
float promedio_de_puntos;
mas_contaminante = 0;
menos_contaminante = 0;
promedio_de_puntos = 0;
for (i=1; i<=25; i++)
{
cout << "PROCESO " << i << endl;
cout << "Ingresa el valor de puntos contaminantes: ";
cin >> puntos_contaminantes;
cin.get();
promedio_de_puntos=promedio_de_puntos+puntos_contaminantes;
if(i==1||mas_contaminante<puntos_contaminantes)
mas_contaminante=puntos_contaminantes;
if(i==1||menos_contaminante>puntos_contaminantes)
menos_contaminante=puntos_contaminantes;
cout << endl;
}
promedio_de_puntos=promedio_de_puntos/25;
cout << "Valor de mas contaminante: " << mas_contaminante << endl;
cout << "Valor de menos contaminante:
" << menos_contaminante << endl;
cout << "Valor de promedio de puntos:
" << promedio_de_puntos << endl;
system ("pause");
return 0;
}
4.