Programasluis
- 1. CODIFICACION Nº 1<br />//PROGRMA PARA LLENAR EL VECTOR DE LOS 10 PARES Y INPARES<br />#include < iostream.h ><br />#include <conio.h><br />#include <stdio.h><br />void main()<br />{<br />int num[10]<br />int i,int j;<br />for(i=2;i<=20;i=i+2)<br />cout<<quot;
numero pares:quot;
<<i<<endl;<br />cin>>num[i];<br />gotoxy(1,12);<br />for(j=1;j<=20;j=j+2)<br />cout<<quot;
numero impares:quot;
<<j<<endl;<br />cin>>num[j];<br />getch();<br />}<br />CODIFICACION Nº 2<br />//PROGRMA del vector de los 10 elementos con 1,2<br />autor luis daquilema 6to informatica<br />#include <stdio.h><br />#include <conio.h><br />#include <iostream.h><br />void main()<br />{<br />int n[10],i,j;<br />cout<<quot;
progrma del vector con elemnto 1,2:quot;
<<endl;<br />for(i=1;i<10;i++)<br />{<br />if(i%2==0)<br />n[i]=2;<br />else<br />n[i]=1;<br />}<br />for(j=1;j<10;j++)<br />{<br />cout<<n[j]<<endl;<br />}<br />getch();<br />}<br />CODIFICACION Nº 3<br />//PROGRMA del vector de los 10 elementos con 1,2,3,4,5 y 1,2,3,4,5<br />//autor luis daquilema 6to informatica<br />#include <iostream.h><br />#include <conio.h><br />#include <stdio.h><br />void main()<br />{<br />int num[2];<br />int n,nu,i=0; int j=0;<br />cout<<quot;
progrma del vector con elemnto 1,2,3,4,5:quot;
<<endl;<br />for(i=1;i<=5;i++)<br />{<br />cout<<quot;
el vector es:quot;
<<i<<endl;<br />}<br />for(j=1;j<=5;j=j+1)<br />{<br />cout<<quot;
el vector es:quot;
<<j<<endl;<br />}<br />getch();<br />}<br />CODIFICACION Nº 4<br />//PROGRMA DEL VECTOR DE SOLO CON EL NUMERO 1<br />//autor luis daquilema 6to informatica<br />#include <iostream.h><br />#include <conio.h><br />#include <stdio.h><br />void main()<br />{<br />int num[1],i=10;<br />cout<<quot;
progrma del vector con elemnto 1:quot;
<<endl;<br />do{<br />cout<<quot;
progrma del vector con elemnto 1:quot;
<<endl;<br />cout<<1<<endl;<br />i++;<br />}while(i<=num[10]);<br />getch();<br />}<br />CODIFICACION Nº 5<br />//PROGRMA DEL VECTOR DE LOS NUMEROS PARES<br />//autor luis daquilema 6to informatica<br />#include <iostream.h><br />#include <conio.h><br />#include <stdio.h><br />void main()<br />{<br />int par[10];<br />int impar[10];<br />cout<<quot;
PROGRAMA DEL VECTOR DE LOS NUMEROPS PARES:quot;
<<endl;<br />int i; int j;int x;int num;int sumpar;<br />sumpar=0;<br />for(i=1;i<=10;i++)<br />{<br />cout<<quot;
INGRESE NUMERO:quot;
<<i<<endl;<br />cin>>num;<br />par[i]=num;<br />}<br />cout<<quot;
EL CONTENIDO DEL VECTOR ES :quot;
<<endl;<br />for(j=1;j<=10;j++)<br />cout<<par[j]<<endl;<br />getch();<br />for(x=1;x<=10;x++)<br />if(par[x]%2==0)<br />sumpar=sumpar+par[x];<br />cout<<quot;
la suma de los numeros pares es:quot;
<<sumpar<<endl;<br />getch();<br />}<br />CODIFICACION Nº 6<br />//PROGRMA DEL VECTOR DE LOS NUMEROS PARES E IMPARES HASTA EL 20<br />//autor luis daquilema 6to informatica<br />#include <iostream.h><br />#include <conio.h><br />#include <stdio.h><br />void main()<br />{<br />float num[10];<br />float num1[10];<br />int i; int j;<br />cout<<quot;
porgrama de los numeros pares e impares hasta el 20:quot;
<<i<<endl;<br />for(i=2;i<=20;i=i+2)<br />cout<<quot;
los numeros pares hasta el 20:quot;
<<i<<endl;<br />gotoxy(1,14);<br />for(j=1;j<=20;j=j+2)<br />cout<<quot;
los numeros impares hasta el 20:quot;
<<j<<endl;<br />cin>>num1[j];<br />getch();<br />}<br />CODIFICACION Nº 7<br />//programa para sumar los numeros impares<br />//autor luis daquilema 6to informatica<br /># include<iostream.h><br /># include<stdio.h><br /># include<conio.h><br />void main()<br />{<br />cout<<quot;
programa para sumar los numeros imparesquot;
<<endl;<br />int numero[10];int num;int i;<br />for(i=1;i<=10;i++)<br />{<br />cout<<quot;
ingrese numeros quot;
<<i<<endl;<br />cin>>num;<br />numero[i]=num;<br />}<br />for(i=1;i<=10;i++)<br />{<br />cout<<quot;
numeros ingresados quot;
;<br />cout<<numero[i]<<endl;<br />}<br />getch();<br />}<br />CODIFICACION Nº 8<br />//PROGRMA DEL VECTOR DE LOS NUMEROS PARES CONTENIDOS<br />//autor luis daquilema 6to informatica<br />#include <iostream.h><br />#include <conio.h><br />#include <stdio.h><br />void main()<br />{<br />int par[10];<br />int impar[10];<br />cout<<quot;
PROGRAMA DEL VECTOR DE LOS NUMEROPS PARES:quot;
<<endl;<br />int i; int j;int x;int num;int sumapares;<br />sumapares=0;<br />for(i=1;i<=10;i++)<br />{<br />cout<<quot;
INGRESE NUMERO:quot;
<<i<<endl;<br />cin>>num;<br />par[i]=num;<br />}<br />cout<<quot;
EL CONTENIDO DEL VECTOR ES :quot;
<<endl;<br />for(j=1;j<=10;j++)<br />cout<<par[j]<<endl;<br />getch();<br />for(x=1;x<=10;x++)<br />if(par[x]%2==0)<br />sumapares=sumapares+par[x];<br />cout<<quot;
la suma de los numeros pares es:quot;
<<sumapares<<endl;<br />getch();<br />}<br />CODIFICACION Nº 9<br />//programa la calculadora<br />//autor Luis daquilema<br />//6to informatica<br />#include <iostream.h><br />#include <conio.h><br />#include <stdio.h><br />void main()<br />{<br />int n1,n2,op;<br />float r;<br />cout<<quot;
autor Luis Daquilema :quot;
<<endl;<br />cout<<quot;
programa calculadora:quot;
<<endl;<br />cout<<quot;
ingrese numero:quot;
;<br />cin>>n1;<br />cout<<quot;
ingrese numero:quot;
;<br />cin>>n2;<br />cout<<quot;
ingrese opcion:quot;
;<br />cin>>op;<br />if(op==1)<br />{<br />r=n1+n2;<br />cout<<quot;
la suma es:quot;
<<r;<br />getch();<br />}<br />if(op==2)<br />{<br />r=n1-n2;<br />cout<<quot;
la resta es:quot;
<<r;<br />getch();<br />}<br />if(op==3)<br />{<br />r=n1*n2;<br />cout<<quot;
la multiplicacion es:quot;
<<r;<br />getch();<br />}<br />if(op==4)<br />{<br />r=n1*n2;<br />cout<<quot;
la division es:quot;
<<r;<br />getch();<br />}<br />else<br />clrscr();<br />getch();<br />clrscr();<br />}<br />CODIFICACION Nº 10<br />//PROGRAMA DE DATOS DE LOS AMIGOS<br />//lUIS DAQUILEMA<br />//SEXTO INFORMATICA<br />#include <iostream.h><br />#include<stdio.h><br />#include<conio.h><br />#define N 3<br />void main()<br />{<br />int cont=0;<br />char op;<br />struct agenda<br />{<br />char nombre[50];<br />int tel;<br />int edad ;<br />}a [10];<br />do<br />{<br />clrscr();<br />cout<<quot;
INGRESE EL NOMBRE DEL AMIGO: quot;
;<br />cin>>(a[cont].nombre);<br />cout<<endl<<quot;
INGRESE EL NUMERO DE TELEFONO: quot;
;<br />cin>>(a[cont].tel) ;<br />cout<<endl<<quot;
INGRESE LA EDAD DEL AMIGO: quot;
;<br />cin>>(a[cont].edad);<br />cout<<endl<<endl<<quot;
¨QUIERE ALMACENAR OTRO REGISTRO SI O NO?quot;
;<br />cin>>op;<br />if(op=='S' || op=='s')<br />{<br />cont+=1;<br />}<br />if(op=='N' || op=='n')<br />{<br />cont=cont+10;<br />}<br />}<br />while(cont<10);<br />clrscr();<br />cont-=10;<br />for(int i=0;i<=cont;i++)<br />{<br />cout<<quot;
NUMERO DE REGISTRO DE LOS CONTACTOS:quot;
<<i+1<<endl<<endl;<br />cout<<quot;
EL NOMBRE DEL AMIGO ES: quot;
<<a[i].nombre<<endl<<endl;<br />cout<<quot;
EL TELEFONO DEL AMIGO ES: quot;
<<a[i].tel<<endl<<endl;<br />cout<<quot;
SU EDAD ES: quot;
<<a[i].edad<<endl<<endl;<br />getch();<br /> }<br />getch();<br />}<br />{<br />cout<<quot;
amigo: quot;
<<amigos[i].nombre<<endl<<quot;
telefono: quot;
<<amigos[i].telefono<<endl<<quot;
edad: quot;
<<amigos[i].edad<<endl;<br />}<br />CODIFICACION Nº 11<br />//PROGRAMA DE REPETICION DE SI O NO DE UN NUMERO<br />#include <iostream.h><br />#include <conio.h><br />#include <stdio.h><br />void main ()<br />{<br />int n,r;<br />char res[2];<br />res[0]='s';<br />res[1]='i';<br />while(res[0]=='s'&&res[1]=='i')<br />{<br />clrscr();<br />cout<<quot;
ingrese un nuero:quot;
;<br />cin>>n;<br />r=n%2;<br />res[0]='i';<br />while(res[0]=='s'&&res[1]=='i')<br />clrscr();<br />cout<<quot;
ingrese un numero:quot;
;<br />ci>>n;<br />r=n%2;<br />if(r==0)<br />cout<<quot;
Parquot;
<<endl;<br />else<br />cout<<quot;
Imparquot;
<<endl;<br />cout<<quot;
Desea seguir si o no: quot;
;<br />cin>>res;<br />}<br /> getch();<br />}<br />CODIFICACION Nº 12<br />//PROGRAMA DE UN NUEMRO PAR O IMPAR<br />#include<iostream.h><br />#include<stdio.h><br />#include<conio.h><br />void main ()<br />{<br />int num;<br />gotoxy(8,8);<br />cout<<quot;
ingrese un numero:quot;
;<br />cin>>num;<br />if (num%2==0)<br />cout<<quot;
Es Parquot;
<<endl;<br />else<br />cout<<quot;
Es imparquot;
<<endl;<br />getch();<br />}<br />CODIFICACION Nº 13<br />//PROGRAMA DE UN NUEMRO MAXIMO<br />#include<iostream.h><br />#include<stdio.h><br />#include<conio.h><br />int maximo (int n1, int n2)<br />{<br />if(n1>n2)<br />return n1;<br />else<br />return n2;<br />};<br />void main ()<br />{<br />int n1, n2;<br />int max;<br />cout<<quot;
ingrese n1:quot;
;<br />cin>>n1;<br />cout<<quot;
ingrese n2:quot;
;<br />cin>>n2;<br />max=maximo(n1,n2);<br />cout<<quot;
El nemero mayor es:quot;
<<max;<br />}<br />CODIFICACION Nº 14<br />PROGRAMA DE DATOS DE MIS AMIGOS CON FUNCIONES<br />#include<stdio.h><br />#include<iostream.h><br />#define n 3<br />struct agenda<br />{<br /> char nombre[25];<br /> char telefono[10];<br /> int edad;<br />};<br />struct agenda a[n];<br />void main()<br />{<br /> for(int i=0;i<n;i++)<br /> {<br /> cout<<quot;
Ingrese nombre: quot;
;<br /> cin>>a[i].nombre;<br /> cout<<quot;
Ingrese edad: quot;
;<br /> cin>>a[i].edad;<br /> cout<<quot;
Ingresar telefono: quot;
;<br /> cin>>a[i].telefono;<br /> }<br /> for(int j=0;j<n;j++)<br /> {<br /> cout<<quot;
El nombre es quot;
<<a[j].nombre;<br /> cout<<quot;
su edad es quot;
<<a[j].edad;<br /> cout<<quot;
y su telefono es quot;
<<a[j].telefono<<endl;<br /> }<br />}<br />CODIFICACION Nº 15<br />//programa del numero mayor con funcion<br />#include<stdio.h><br />#include<iostream.h><br />#include<conio.h><br />int maximo()<br />{<br />int n1, n2;<br />int max;<br />cout << quot;
Ingrese n1: quot;
;<br />cin>>n1;<br />cout << quot;
Ingrese n2: quot;
;<br />cin>>n2;<br />max=(n1,n2);<br />if(n1>n2)<br />max=n1;<br />else<br />max=n2;<br />return max;<br />};<br />int main()<br />{<br />int max;<br />max=maximo();<br />cout<<quot;
El numero mayor es:quot;
<< max;<br />}<br />CODIFICACION Nº 16<br />//programa de datos de una persona<br />#include <stdio.h><br />#include <conio.h><br />#include <iostream.h><br />int telefono(int, int);<br />int edad(int, int);<br />int res, res3,res2;<br />int r,r3,r2;<br />void main()<br />{<br />char nom[50];<br />char nom1[30];<br />int i;int j;<br />int n1,n2,res2,res1,res3;<br />cout<<quot;
programa de datos de una persona quot;
<<endl;<br />int e1,e2,r2,r1,r3;<br />int d1,d2,m1,m2,m3;<br />for (i=1;i<=2;i++)<br />{<br />cout<<quot;
ingrese nombre quot;
<<endl;<br />}<br />gotoxy(20,2);<br />cin>>nom;<br />gotoxy(20,3);<br />cin>>nom1;<br />res1=telefono(n1,n2);<br />res3=telefono(n1,n2);<br />r1=edad(e1,e2);<br />r3=edad(e1,e2);<br />}<br />int telefono(int n1,int n2)<br />{<br />cout<<quot;
ingrese telefono: quot;
;<br />cin>>n1;<br />res=n1;<br />return(res);<br />cout<<quot;
ingrese telefono 2: quot;
;<br />cin>>n2;<br />res2=n2;<br />return(res3);<br />}<br />int edad(int e1,int e2)<br />{<br />cout<<quot;
ingrese edad: quot;
;<br />cin>>e1;<br />r=e1;<br />return(r);<br />cout<<quot;
ingrese edad 2 quot;
;<br />cin>>e2;<br />r2=e2;<br />return(r2);<br />getch();<br />}<br />CODIFICACION Nº 17<br />//PROGRAMA QUE INGRESA NUMEROS LOS VECTORES Y SUMA LOS NUMEROS PARES<br />#include <iostream.h><br />#include <conio.h><br />#include <stdio.h><br />void main()<br />{<br />int par[10];<br />int impar[10];<br />int i; int j;int x;int num;int sumapares;<br />sumapares=0;<br />for (i=1;i<=10;i++)<br />{<br />cout<<quot;
ingrese un numero:quot;
<<i<<endl;<br /> cin>>num;<br /> par[i]=num;<br />}<br />cout<<quot;
El Contenido del vector es:quot;
<<endl;<br />for(j=1; j<=10;j++)<br />cout<<par[j]<<endl;<br />getch();<br />for(x=1;x<=10;x++)<br />if (par[x]%2==0)<br />sumapares=sumapares+par[x];<br />cout<<quot;
La suma de los numeros pares es:quot;
<<sumapares<<endl;<br />getch();<br />}<br />CODIFICACION Nº 18<br />//PROGRAMA QUE INGRESA ELEMENTOS EN UN VETOR<br />#include <iostream.h><br />#include <conio.h><br />#include <stdio.h><br />void main()<br />{<br />int num[20]<br />int i;int j;<br />for (i=0;i<=5;i++)<br />{<br />cout<<i<<endl;<br />}<br />cout<<quot;
Elementos ingresados:quot;
<<i<<endl;<br />getch();<br />}<br />CODIFICACION Nº 19<br />//PROGRAMA LA FRASE<br />//AUTOR LUIS DAQUILEMA 6to INFORMATICA<br />#include <iostream.h><br />#include <conio.h><br />#include <string.h><br />int main()<br />{<br />int ma=0,me=0,mi=0,mo=0,mu=0,s=0,t,ar;<br />char frase[40];<br /> {<br /> clrscr();<br /> cout<<quot;
ingrese la frase:quot;
<<endl;<br /> cin.getline(frase,40);<br /> t=strlen(frase);<br /> cout<<quot;
La frase tienequot;
<<endl;<br />for(int c=0;c<39;c++)<br />{<br />if (frase[c]=='a')<br />ma++;<br />else<br />if (frase[c]=='e')<br />me++;<br />else<br />if(frase[c]=='i')<br />mi++;<br />else<br />f (frase[c]=='o')<br />mo++;<br />else<br />if (frase[c]=='u')<br />mu++;<br />else<br />if(frase[c]==' ')<br />s++;<br />}<br />cout<<quot;
el total A:quot;
<<ma<<endl;<br />cout<<quot;
el total E:quot;
<<me<<endl;<br />cout<<quot;
el total I:quot;
<<mi<<endl;<br />cout<<quot;
el total O:quot;
<<mo<<endl;<br />cout<<quot;
el total U:quot;
<<mu<<endl;<br />cout<<quot;
el total de espacios en blancoquot;
<<s<<endl;<br /> }<br /> getch();<br />}<br />CODIFICACION Nº 20<br />//PROGRAMA METODO DE LA BURBUJA<br />#include <iostream.h><br />#include <math.h><br />#include <stdlib.h><br />void main()<br />{<br />int i,m,j,a[10];<br />cout<<quot;
METODO DE LA BURBUJA (forma descendente)quot;
<<endl;<br />for(i=0;i<10;i++)<br />{<br />cout<<quot;
CAPTURANDOquot;
<<quot;
[quot;
<<i<<quot;
] : quot;
;cin>>a[i];<br />}<br />for(i=0;i<10;i++)<br />{<br />for(j=0;j<10-1;j++)<br />{<br />if(a[i]>a[j])<br />{<br />m=a[i];<br />a[i]=a[j];<br />a[j]=m;<br />}<br />}<br />}<br />cout<<quot;
numeros ordenadosquot;
;<br />for(i=0;i<10;i++)<br />{<br />cout<<quot;
A[quot;
<<i<<quot;
] : quot;
<<a[i];<br />}<br />getch();<br />}<br />CODIFICACION Nº 21<br />//PROGRAMA DE LA TABLA DE MULTIPLICAR DEL 5 YA INGRESADOS<br />#include <iostream.h><br />#include <conio.h><br />void main()<br />{<br />int a[10],b[10],c[10],i;<br />i=5;<br />for(int j=0;j<11;j++)<br />{<br />c[10]=i*j;<br />cout<<i<<quot;
x quot;
<<j<<quot;
* quot;
<<c[10]<<endl;<br />}<br />getch();<br />}<br />CODIFICACION Nº 22<br />//programa que ordena de mayor a menor<br />#include <iostream.h><br />#include <conio.h><br />#include <stdio.h><br />void main()<br />{<br />int vet[10],i,j,numero,aux;<br />cout<<quot;
ingrese los numeros:quot;
<<endl;<br />for(i=0;i<10;i++)<br />{<br />cin>>numero;<br />vet[i] = numero;<br />}<br />cout<<quot;
los nuemros desordenados sonquot;
<<endl;<br />for(i=0;i<10;i++)<br />{<br />cout<<vet[i]<<endl;<br />}<br />cout<<quot;
los numeros ordenados son quot;
<<endl;<br />for(i=0;i<9;i++)<br /> for(j=i+1;j<10;j++)<br /> {<br />if(vet[i]<vet[j])<br />{<br />aux=vet[i];<br />vet[i]=vet[j];<br />vet[j]=aux;<br />}<br /> }<br />for(i=0;i<10;i++)<br /> cout<<vet[i]<<endl;<br />getch();<br />clrscr();<br />}<br />CODIFICACION Nº 23<br />//programa que ordena de menor a mayor<br />#include <iostream.h><br />#include <conio.h><br />#include <stdio.h><br />void main()<br />{<br />int vet[10],i,j,numero,aux;<br />cout<<quot;
ingrese los numeros:quot;
<<endl;<br />for(i=0;i<10;i++)<br />{<br />cin>>numero;<br />vet[i] = numero;<br />}<br />cout<<quot;
los nuemros desordenados sonquot;
<<endl;<br />for(i=0;i<10;i++)<br />{<br />cout<<vet[i]<<endl;<br />}<br />cout<<quot;
los numeros ordenados son quot;
<<endl;<br />for(i=0;i<9;i++)<br /> for(j=i+1;j<10;j++)<br /> {<br />if(vet[i]>vet[j])<br />{<br />aux=vet[i];<br />vet[i]=vet[j];<br />vet[j]=aux;<br />}<br /> }<br />for(i=0;i<10;i++)<br /> cout<<vet[i]<<endl;<br />getch();<br />clrscr();<br />}<br />CODIFICACION Nº 24<br />//PROGRAMA PARA ORDENAR LAS LETREAS<br />#include <iostream.h><br />#include <conio.h><br />#include <stdio.h><br />#include <string.h><br />#include <stdio.h><br />void ingresarLetras(char letra[])<br />{<br />for(int i=0;i<10;i++)<br />{<br />cout<<quot;
ingrese letras a ordenar:quot;
;<br />cin>>letra[i];<br />}<br />}<br />void ordenarLetras(char letra[])<br />{<br />int t;<br />for(int i=0;i<10;i++)<br />for(int j=10-1;j>-1;j--)<br />if((letra[j-1]>letra[j]))<br />{<br />t=letra[j-1];<br />letra[j-1]=letra[j];<br />letra[j]=t;<br />}<br />}<br />void reportar(char letra[])<br />{<br />cout<<quot;
las letras ordenadas son:quot;
;<br />for(int i=0;i<10;i++)<br />{<br />cout<<letra[i]<<quot;
quot;
;<br />}<br />cout<<endl;<br />}<br />void main()<br />{<br />char letra[10];<br />ingresarLetras(letra);<br />ordenarLetras(letra);<br />reportar(letra);<br />getch();<br />}<br />CODIFICACION Nº 25<br />//RECIBEN Y RETORNA<br />#include <iostream.h><br />#include <stdio.h><br />#include <conio.h><br />int mayor(int n1,int n2)<br />{<br />if (n1>n2)<br />cout<<quot;
el numero mayor es quot;
<<n1<<endl<<quot;
el nuemro menor es quot;
<<n2<<endl;<br />else<br />cout<<quot;
el numero mayor es quot;
<<n2<<endl<<quot;
el nuemro menor es quot;
<<n1<<endl;<br />getch();<br />return (n1,n2)<br />}<br />int main()<br />{<br />int n1, n2;<br />cout<<quot;
Numro 1; quot;
;cin>>n1;<br />cout<<quot;
Numro 2; quot;
;cin>>n2;<br />mayor(n1,n2)<br />}<br />CODIFICACION Nº 26<br />//PROGRAMA QUE INGRESA ELEMENTOS EN UN VECTOR<br />#include <iostream.h><br />#include <stdio.h><br />#include <conio.h><br />#include <string.h><br />int telefono(int, int)<br />int edad(int, int)<br />int res,res3,res2;<br />int r,r3,r2;<br />int q3,q,q2;<br />void main()<br />{<br />char nom[45];<br />char nom[35];<br />int i;int j;<br />int n1,n2,res2,res1,res3;<br />int e1,e2,r2,r1,r3;<br />int q1,q2,,q,q3;<br />for (i=1;i<=2;i++)<br />{<br />cout<<quot;
ingrese nombrequot;
<<i<<quot;
: quot;
<<endl;<br />}<br />gotoxy(18,1);<br />cin>>nom;<br />gotoxy(18,2);<br />cin>>nom1;<br />cout<<endl;<br />res1=telefono(n1,n2);<br />res3=telefono(n1,n2);<br />r1=edad(e1,e2);<br />r3=edad(e1,e2);<br />cout<<quot;
el numero telefonico de: quot;
<<nom<<quot;
,es: quot;
<<res1<<quot;
, la edad es: quot;
<<r1<<endl;<br />cout<<quot;
el numero telefonico de: quot;
<<nom1<<quot;
,es: quot;
<<res3<<quot;
, la edad es: quot;
<<r3<<endl<br />getch();<br />}<br />int telefono(int n1,int n2)<br />{<br />cout<<quot;
ingrese el telefono; quot;
;<br />cin>>n1;<br />res=n1;<br />return(res);<br />cout<<quot;
ingrese el telefono2; quot;
;<br />cin>>n2;<br />res2=n2;<br />return(res3);<br />}<br />int telefono(int n1,int n2)<br />{<br />cout<<quot;
ingrese la edad; quot;
;<br />cin>>e1;<br />r=e1;<br />return(r);<br />cout<<quot;
ingrese la edad2; quot;
;<br />cin>>e2;<br />r2=e2;<br />return(r2);<br />}<br />CODIFICACION Nº 27<br />#include <iostream.h><br />#include <stdio.h><br />#include <conio.h><br />int maximo(){int n1, n2;int max;cout << quot;
Ingrese n1: quot;
;cin>>n1;cout << quot;
Ingrese n2: quot;
;cin>>n2;max=(n1,n2);if(n1>n2)max=n1;elsemax=n2;return max;};int main(){int max;max=maximo();cout<<quot;
El numero mayor es:quot;
<< max;}<br />CODIFICACION Nº 28<br />//PROGRAMA DE DATOS DE LOS AMIGOS<br />//lUIS DAQUILEMA<br />//SEXTO INFORMATICA<br />#include <iostream.h><br />#include<stdio.h><br />#include<conio.h><br />#define N 3<br />void main()<br />{<br />int cont=0;<br />char op;<br />struct agenda<br />{<br />char nombre[50];<br />int tel;<br />int edad ;<br />}a [10];<br />do<br />{<br />clrscr();<br />cout<<quot;
INGRESE EL NOMBRE DEL AMIGO: quot;
;<br />cin>>(a[cont].nombre);<br />cout<<endl<<quot;
INGRESE EL NUMERO DE TELEFONO: quot;
;<br />cin>>(a[cont].tel) ;<br />cout<<endl<<quot;
INGRESE LA EDAD DEL AMIGO: quot;
;<br />cin>>(a[cont].edad);<br />cout<<endl<<endl<<quot;
¨QUIERE ALMACENAR OTRO REGISTRO SI O NO?quot;
;<br />cin>>op;<br />if(op=='S' || op=='s')<br />{<br />cont+=1;<br />}<br />if(op=='N' || op=='n')<br />{<br />cont=cont+10;<br />}<br />}<br />while(cont<10);<br />clrscr();<br />cont-=10;<br />for(int i=0;i<=cont;i++)<br />{<br />cout<<quot;
NUMERO DE REGISTRO DE LOS CONTACTOS:quot;
<<i+1<<endl<<endl;<br />cout<<quot;
EL NOMBRE DEL AMIGO ES: quot;
<<a[i].nombre<<endl<<endl;<br />cout<<quot;
EL TELEFONO DEL AMIGO ES: quot;
<<a[i].tel<<endl<<endl;<br />cout<<quot;
SU EDAD ES: quot;
<<a[i].edad<<endl<<endl;<br />getch();<br /> }<br />getch();<br />}<br />{<br />cout<<quot;
amigo: quot;
<<amigos[i].nombre<<endl<<quot;
telefono: quot;
<<amigos[i].telefono<<endl<<quot;
edad: quot;
<<amigos[i].edad<<endl;<br />}<br />cout<<N<<endl;<br />getch();<br />CODIFICACION Nº 29<br />//PROGRAMA PARA CALCULAR EL NUMERO MAYOR Y MENOR<br />#include<stdio.h><br />main(void)<br />{int num,mayor,menor,x;<br /> mayor=0;<br /> menor=10000;<br /> for(x=1; x<=8;x++)<br /> {<br /> cout<<quot;
INGRESAR NÚMEROquot;
<<x;<br /> cin>>num;<br /> if(mayor<num) mayor=num;<br /> if(menor>num) menor=num;<br /> }<br />cout<<quot;
NÚMERO MAYOR:quot;
<<mayor;<br />cout<<quot;
NÚMERO MENOR:quot;
<<menor;<br />return 0;<br />}<br />