Documentos de Académico
Documentos de Profesional
Documentos de Cultura
FACULTAD DE INGENIERIA
ESCUELA PROFESIONAL DE INGENIERIA METALURGIA
CURSO:
FUNDAMENTOS DE PROGRAMACION
ALUMNO:
DIEGO FABRIZIO LIMA FELICIANO
CODIGO:
2023-103039
DOCENTE:
Ing. Miguel Angel Laquihuanaco Chiarella
CICLO:
I-B
TACNA - PERÚ
2023
TRABAJO N°1
HALLAR A, B, C, D
A=4
B=4
C=4
D=4
A: A+B=4+4=8
B: A-B=8-4=4
C: A+B=8+4=12
D: A-B=8-4=4
A: A-B=8-4=4
B: A+B=4+4=8
C: A-B=4-8=-4
D: A+B=4+8=12
RESPUESTA
A=4
B=8
C=-4
D=12
TRABAJO N°2
Densidad
DISEÑO DE ALGORITMO
Inicio
leer pm,vi,vf
Fin
DIAGRAMA DE FLUJO
C++
#include<iostream.h>
#include<conio.h>
main()
{//inicio
float d,pm,vi,vf;
cin>>pm;
cin>>vi;
cin>>vf;
d=pm/(vf-vi);
getch();
}
TRABAJO N°3
TRAPECIO RECTANGULAR
ALGORITMO
Algoritmo trapecio_rectangulo
leer D;
leer b;
escribir"altura= ";
leer h;
leer l1;
leer l2;
A<-(D+d)/2*h;
P<-D+b+l1+l2;
FinAlgoritmo
DIAGRAMA DE FLUJO
C++
#include<iostream>
#include<conio.h>
#include<math.h>
main()
{ //inicio
float A,P,B,b,h,x;
cin>>B;
cin>>b;
cin>>h;
x=sqrt(pow(B-b,2)+pow(h,2));
cout <<"Lado(x)=>"<<x;
P=B+b+h+x;
cout <<"\nPerimetro="<<P;
A=(B+b)*h/2;
cout <<"\nArea="<<A;
getch();
} // fin
TRABAJO N°4
TONELADA
Algoritmo toneladas
Escribir"TM";
Leer TM;
lb=TM+2205
Tc=TM+1102
FinAlgoritmo
DIAGRAMA DE FLUJO
C++
#include<iostream.h>
#include<conio.h>
main()
int TM;
float lb,Tc;
cout<<"TM= ";
cin>>TM;
lb=TM+2205;
Tc=TM+1102;
cout<<"lb="<<lb<<endl;
cout<<"Tc="<<Tc;
getch();
}
TRABAJO N°5
#include <conio.h>
main()
float r,A;
cout<<"Radio =";
cin>>r;
A=pi*r*r;
getch();
Año de ingreso
#include <iostream.h>
#include <conio.h>
main()
{int year,a,b;
cin>>year;
getch();
cout<<"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bCachimbo";
getch();
REDONDEO
#include <iostream.h>
#include <conio.h>
#include <math.h>
main()
float num;
cout<<"Numero=>";
cin>>num;
cout<<"Redondeando al superior es= "<<ceil(num);
getch();
VALOR ABSOLUTO
#include <iostream.h>
#include <conio.h>
#include <math.h>
main()
{float num;
cout<<"Numero=> ";
cin>>num;
getch();
}
TRABAJO N°6
C++
#include "iostream.h"
#include "math.h"
#include <conio.h>
main()
{
float L,H,P,a,Ab,Al,At,V;
cin>>L;
cin>>H;
P=6*L*H;
a=sqrt(pow(L,2)-L/2);
Ab=(6*a*L)/2;
Al=6*L*H;
At=2*Ab+Al;
V=Ab*H;
cout<<"Area= "<<At<<"m2";
cout<<"\nVolumen= "<<V<<"m3";
getch();
AREA DE LA PIRAMIDE
Diagrama de flujo
C++
#include "iostream.h"
#include <conio.h>
#include <math.h>
main()
float Ab,Al,At,h,ap,b,V;
cin>>b;
cin>>h;
Ab=pow(b,2);
ap=sqrt(pow((b/2),2)+pow(h,2)),2;
Al=4*b*ap/2;
At=Ab+Al;
V=(Ab*1/3)*h;
getch();
HALLAR EL NOMBRE
C++
#include <iostream.h>
#include <stdlib.h>
#define INICIO{
#define FIN}
#define ESCRIBIR(texto)cout<<texto<<"\n"
main()
INICIO
char var[20];
ESCRIBIR("Ingrese un nombre");
LEER(var);
ESCRIBIR(var);
PAUSA;
FIN
TRABAJO N°7
#include <conio.h>
#include <math.h>
#define PI 3.1416
main()
{
float r,h,V;
cout<<"radio=> ";
cin>>r;
cout<<"altura=> ";
cin>>h;
V=(PI*pow(r,2))*h;
getch();
ENCONTRAR LA NOTA
Diagrama de flujo
C++
#include <iostream>
#include <stdlib.h>
main()
{ float nota;
cin>>nota;
if (nota>=10.5)
system("PAUSE");
}
TRABAJO N°8
C++
#include "iostream.h"
#include "conio.h"
main()
{int a,b,c;
cout<<"a= ";cin>>a;
cout<<"b= ";cin>>b;
cout<<"c= ";cin>>c;
if (a<b)
{if (a<c)
{if(b<c)
cout<<a<<endl<<b<<endl<<c;
else
cout<<a<<endl<<c<<endl<<b;
else
cout<<c<<endl<<a<<endl<<b;
else
if (b<c)
if (a<c)
cout<<b<<endl<<a<<endl<<c;
else
cout<<b<<endl<<c<<endl<<a;
else
cout<<c<<endl<<b<<endl<<a;
getch();
GRADOS O RADIANES
#include <iostream.h>
#include <conio.h>
main()
{
float G,r;
int opc;
cout<<"*****************\n";
cout<<"*****************\n";
cout<<"*****************\n";
TRABAJO N°9
NOMBRE Y SUMA
#include "iostream.h"
#include <conio.h>
#include <stdio.h>
main()
float x=1.2, r;
char c;
char ap[20];
s=a+b;
r=a-x;
cin>>a;
s=a+b;
cin>>c;
cout<<endl<<c;
gets(ap);
cout<<endl<<ap;
getch();
PESO EN NEWTON
#include "iostream.h"
#include "conio.h"
#define g =9.81
main()
float m,W;
cout<<"masa en kg ";
cin>>m;
W=m*g;
cout<<"W(N)= "<<W;
getch();
NOMBRE
#include <iostream.h>
#include <stdlib.h>
#define INICIO{
#define FIN}
#define ESCRIBIR(texto)cout<<texto<<"\n"
#define LEER(variable)cin>>variable
main()
INICIO
char var[20];
ESCRIBIR("Ingrese un nombre");
LEER(var);
ESCRIBIR(var);
PAUSA;
FIN
TRABAJO N°10
TABLA DE OPERACIONES
Diagrama de flujo
C++
#include "iostream.h"
#include <conio.h>
main()
int opc;
float n1,n2,R;
cout<<"\tCalcuradora basica\n";
cout<<"\t================\n";
cout<<"\t1=Suma\n";
cout<<"\t2=Resta\n";
cout<<"\t3=Division\n";
cout<<"\t4=Multiplicacion\n";
cout<<"\t5=Salir\n";
cout<<"\tOpcion=> ";cin>>opc;
switch (opc)
R=n1+n2;
cout<<"\nLa suma es = "<<R;
break;
R=n1-n2;
break;
R=n1/n2;
break;
R=n1*n2;
break;
case 5:cout<<"\nGracias...";
break;
getch();
}
TRABAJO N°11
ANGULOS
#include "iostream.h"
#include <conio.h>
main()
{//inicio
float angulo;
if(angulo>0)
{if(angulo>=180)
{if(angulo==180)
cout<<"llano";
else
if(angulo>=360)
if(angulo=360)
cout<<"Perigonal";
else
cout<<"no considerado";
else
cout<<"concavo";
else
{cout<<"convexo";
if(angulo>90)
cout<<"obtuso";
else
if(angulo==90)
cout<<"recto";
else
cout<<"agudo";
else
cout<<"error";
getch();
TRABAJO N°12
EXAMEN
Diagrama de Flujo
C++
#include "iostream.h"
#include <conio.h>
#include <math.h>
int main()
{//inicio
float x,y,ang,angrad;
cout<<"ingrese x= ";cin>>x;
cout<<"ingrese y= ";cin>>y;
angrad=atan2(x,y);
ang=angrad*(180/3.1416);
cout<<"El angulo formado es = "<<ang;
{if(x>=0)
{if(y>=0)
cout<<"CUADRANTE I ";
else
{if(x<0)
else
cout<<"CUADRANTE IV";
else
{if(y>0)
cout<<"CUADRANTE II";
else
{if(x>0)
cout<<"CUADRANTE IV ";
else
cout<<"CUADRANTE III";
getch();
}
TRABAJO N°13
MULTIPLO
#include <iostream.h>
#include <conio.h>
main()
{int m,Li,Ls,c;
cout<<"Li= ";cin>>Li;
cout<<"Ls= ";cin>>Ls;
cout<<"multiplo= ";cin>>m;
if(Li<Ls)
{c=Li;
while(c<=Ls)
{if(c%m==0)
cout<<c<<endl;
c++;
else
cout<<"ERROR";
getch();
}
#include <iostream.h>
#include <conio.h>
#include <math.h>
main()
int i,n,j;
double v;
cout<<"n= ";cin>>n;
v=ceil(n/2)+1;
if(n%2!=0)
{for(i=1;i<=v;i++)
{for(j=1;j<=v-i;j++)
cout<<" ";
for(j=1;j<=i*2-1;j++)
cout<<"*";
cout<<endl;
getch();
}
TRIANGULO INVERTIDA
DIAGRAMA DE FLUJO
C++
#include <iostream.h>
#include <conio.h>
main()
{
int n;
cout<<endl;
cout<<" ";
for(int i =0;i<n-k;i++)
cout<<"*";
cout<<endl;
getch();
PRACTICA 14°
(1) unión
(2) intersección
(3) complemento de A
(4) complemento de B
(5) SALIR
OPCION
C++
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
int opcion;
while (true) {
if (opcion == 1) {
mostrarConjunto(unionConjuntos(conjuntoA, conjuntoB));
} else if (opcion == 2) {
mostrarConjunto(interseccionConjuntos(conjuntoA, conjuntoB));
} else if (opcion == 3) {
mostrarConjunto(complementoConjunto(conjuntoA, universo));
} else if (opcion == 4) {
mostrarConjunto(complementoConjunto(conjuntoB, universo));
} else if (opcion == 5) {
break;
} else {
cout << "Opcion invalida. Por favor seleccione una opcion valida" << endl;
return 0;
resultado.push_back(elemento);
return resultado;
vector<int> resultado;
resultado.push_back(elemento);
return resultado;
vector<int> resultado;
resultado.push_back(elemento);
return resultado;
}
int numElementos;
cout << "Ingrese el numero de elementos del conjunto " << nombreConjunto << ": ";
vector<int> conjunto;
int elemento;
conjunto.push_back(elemento);
return conjunto;
PRACTICA 15°
VECTORES Y MATRIZES
Diagrama de flujo
C++
#include <iostream>
int main() {
int matriz[3][3];
int det = 0;
for (int i = 0; i < 3; i++) {
cout << "Ingrese el valor de la matriz en la posicion [" << i << "][" << j << "]: ";
cout << "El determinante de la matriz es: " << det << endl;
return 0;