CODIFICACION Nº 1

//PROGRMA PARA LLENAR EL VECTOR DE LOS 10 PARES Y INPARES

#include < iostream.h >

#include <conio.h>

#include <stdio.h>

void main()

{

       int num[10]

       int i,int j;



       for(i=2;i<=20;i=i+2)

       cout<<"numero pares:"<<i<<endl;

       cin>>num[i];

       gotoxy(1,12);



       for(j=1;j<=20;j=j+2)

       cout<<"numero impares:"<<j<<endl;

       cin>>num[j];

       getch();

}
CODIFICACION Nº 2

//PROGRMA del vector de los 10 elementos con 1,2


autor luis daquilema 6to informatica


#include <stdio.h>


#include <conio.h>


#include <iostream.h>


void main()


{


         int n[10],i,j;


         cout<<"progrma del vector con elemnto 1,2:"<<endl;


         for(i=1;i<10;i++)


                     {


                              if(i%2==0)


                                         n[i]=2;


                              else


                                         n[i]=1;


                     }


                     for(j=1;j<10;j++)


                     {


                              cout<<n[j]<<endl;


                     }


         getch();


}
CODIFICACION Nº 3

//PROGRMA del vector de los 10 elementos con 1,2,3,4,5 y 1,2,3,4,5


//autor luis daquilema 6to informatica


#include <iostream.h>


#include <conio.h>


#include <stdio.h>


void main()


{


       int num[2];


       int n,nu,i=0; int j=0;


       cout<<"progrma del vector con elemnto 1,2,3,4,5:"<<endl;


       for(i=1;i<=5;i++)


                  {


                                cout<<"el vector es:"<<i<<endl;


                  }




       for(j=1;j<=5;j=j+1)


                  {


                                cout<<"el vector es:"<<j<<endl;


                  }


       getch();
}


                          CODIFICACION Nº 4

//PROGRMA DEL VECTOR DE SOLO CON EL NUMERO 1

//autor luis daquilema 6to informatica

#include <iostream.h>

#include <conio.h>

#include <stdio.h>

void main()

{

     int num[1],i=10;

     cout<<"progrma del vector con elemnto 1:"<<endl;

     do{

           cout<<"progrma del vector con elemnto 1:"<<endl;

           cout<<1<<endl;

           i++;

           }while(i<=num[10]);
getch();

}

                                      CODIFICACION Nº 5

//PROGRMA DEL VECTOR DE LOS NUMEROS PARES


//autor luis daquilema 6to informatica


#include <iostream.h>


#include <conio.h>


#include <stdio.h>


void main()


{


       int par[10];


       int impar[10];


       cout<<"PROGRAMA DEL VECTOR DE LOS NUMEROPS PARES:"<<endl;


       int i; int j;int x;int num;int sumpar;


       sumpar=0;


       for(i=1;i<=10;i++)


       {


                        cout<<"INGRESE NUMERO:"<<i<<endl;


                        cin>>num;


                        par[i]=num;
}


    cout<<"EL CONTENIDO DEL VECTOR ES :"<<endl;


    for(j=1;j<=10;j++)


                   cout<<par[j]<<endl;


    getch();


    for(x=1;x<=10;x++)


                   if(par[x]%2==0)


                          sumpar=sumpar+par[x];


    cout<<"la suma de los numeros pares es:"<<sumpar<<endl;


    getch();


}
CODIFICACION Nº 6

//PROGRMA DEL VECTOR DE LOS NUMEROS PARES E IMPARES HASTA EL 20


//autor luis daquilema 6to informatica


#include <iostream.h>


#include <conio.h>


#include <stdio.h>


void main()


{


        float num[10];


        float num1[10];


        int i; int j;


        cout<<"porgrama de los numeros pares e impares hasta el 20:"<<i<<endl;




        for(i=2;i<=20;i=i+2)


        cout<<"los numeros pares hasta el 20:"<<i<<endl;


        gotoxy(1,14);




        for(j=1;j<=20;j=j+2)


        cout<<"los numeros impares hasta el 20:"<<j<<endl;


        cin>>num1[j];


        getch();


}
CODIFICACION Nº 7

//programa para sumar los numeros impares


//autor luis daquilema 6to informatica


# include<iostream.h>


# include<stdio.h>


# include<conio.h>


void main()


{




        cout<<"programa para sumar los numeros impares"<<endl;


        int numero[10];int num;int i;


        for(i=1;i<=10;i++)




        {


        cout<<"ingrese numeros "<<i<<endl;


        cin>>num;


        numero[i]=num;


        }


        for(i=1;i<=10;i++)


        {


        cout<<"numeros ingresados ";
cout<<numero[i]<<endl;


        }


        getch();


}




                                         CODIFICACION Nº 8

//PROGRMA DEL VECTOR DE LOS NUMEROS PARES CONTENIDOS


//autor luis daquilema 6to informatica


#include <iostream.h>


#include <conio.h>


#include <stdio.h>


void main()


{


        int par[10];


        int impar[10];


        cout<<"PROGRAMA DEL VECTOR DE LOS NUMEROPS PARES:"<<endl;


        int i; int j;int x;int num;int sumapares;


        sumapares=0;


        for(i=1;i<=10;i++)


        {


                          cout<<"INGRESE NUMERO:"<<i<<endl;


                          cin>>num;
par[i]=num;


         }


         cout<<"EL CONTENIDO DEL VECTOR ES :"<<endl;


         for(j=1;j<=10;j++)


                            cout<<par[j]<<endl;


         getch();


         for(x=1;x<=10;x++)


                            if(par[x]%2==0)


                                    sumapares=sumapares+par[x];


         cout<<"la suma de los numeros pares es:"<<sumapares<<endl;


         getch();


}


                                       CODIFICACION Nº 9
//programa la calculadora


//autor Luis daquilema


//6to informatica


#include <iostream.h>


#include <conio.h>


#include <stdio.h>


void main()


{


         int n1,n2,op;
float r;


cout<<"autor Luis Daquilema :"<<endl;


cout<<"programa calculadora:"<<endl;


cout<<"ingrese numero:";


cin>>n1;


cout<<"ingrese numero:";


cin>>n2;


cout<<"ingrese opcion:";


cin>>op;


if         (op==1)


{


           r=n1+n2;


           cout<<"la suma es:"<<r;


           getch();


}


if         (op==2)


{


           r=n1-n2;


           cout<<"la resta es:"<<r;


           getch();


}


if         (op==3)


{


           r=n1*n2;
cout<<"la multiplicacion es:"<<r;


                   getch();


       }


       if          (op==4)


       {


                   r=n1*n2;


                   cout<<"la division es:"<<r;


                   getch();


       }


       else


       clrscr();


       getch();


       clrscr();


}


                                             CODIFICACION Nº 10

//PROGRAMA DE DATOS DE LOS AMIGOS

//lUIS DAQUILEMA

//SEXTO INFORMATICA

#include <iostream.h>

#include<stdio.h>

#include<conio.h>

#define N 3

void main()

{

       int cont=0;
char op;



struct agenda

{

           char nombre[50];

           int tel;

           int edad ;

}a [10];

do

{

           clrscr();

           cout<<"INGRESE EL NOMBRE DEL AMIGO: ";

           cin>>(a[cont].nombre);

           cout<<endl<<"INGRESE EL NUMERO DE TELEFONO: ";

           cin>>(a[cont].tel) ;

           cout<<endl<<"INGRESE LA EDAD DEL AMIGO: ";

cin>>(a[cont].edad);

cout<<endl<<endl<<"¨QUIERE ALMACENAR OTRO REGISTRO SI O NO?";

                       cin>>op;

                       if(op=='S' || op=='s')

                       {

                               cont+=1;

                       }

                       if(op=='N' || op=='n')

                       {

                               cont=cont+10;

                       }
}



        while(cont<10);

        clrscr();

        cont-=10;

        for(int i=0;i<=cont;i++)

        {

                    cout<<"NUMERO DE REGISTRO DE LOS CONTACTOS:"<<i+1<<endl<<endl;

                    cout<<"EL NOMBRE DEL AMIGO ES: "<<a[i].nombre<<endl<<endl;

                    cout<<"EL TELEFONO DEL AMIGO ES: "<<a[i].tel<<endl<<endl;

                    cout<<"SU EDAD ES: "<<a[i].edad<<endl<<endl;

                    getch();

        }

        getch();

        }

        {

       cout<<"amigo: "<<amigos[i].nombre<<endl<<"telefono:
"<<amigos[i].telefono<<endl<<"edad: "<<amigos[i].edad<<endl;

}

                                       CODIFICACION Nº 11

//PROGRAMA DE REPETICION DE SI O NO DE UN NUMERO

#include <iostream.h>

#include <conio.h>

#include <stdio.h>

void main ()

{

        int n,r;
char res[2];

       res[0]='s';

       res[1]='i';

       while(res[0]=='s'&&res[1]=='i')

       {

                clrscr();

                cout<<"ingrese un nuero:";

                cin>>n;

                r=n%2;

                res[0]='i';

                while(res[0]=='s'&&res[1]=='i')



                            clrscr();

                            cout<<"ingrese un numero:";

                            ci>>n;

                            r=n%2;

                            if(r==0)

                                        cout<<"Par"<<endl;

                            else

                                        cout<<"Impar"<<endl;

                            cout<<"Desea seguir si o no: ";

                            cin>>res;

       }

getch();

}

                                            CODIFICACION Nº 12

//PROGRAMA DE UN NUEMRO PAR O IMPAR
#include<iostream.h>

#include<stdio.h>

#include<conio.h>

void main ()

{

        int num;

        gotoxy(8,8);

        cout<<"ingrese un numero:";

        cin>>num;

        if (num%2==0)

                        cout<<"Es Par"<<endl;

        else

                               cout<<"Es impar"<<endl;

        getch();

}

                                      CODIFICACION Nº 13

//PROGRAMA DE UN NUEMRO MAXIMO

#include<iostream.h>

#include<stdio.h>

#include<conio.h>



int maximo (int n1, int n2)

{

        if(n1>n2)

        return n1;

        else

        return n2;
};

void main ()

{

          int n1, n2;

          int max;

          cout<<"ingrese n1:";

          cin>>n1;

          cout<<"ingrese n2:";

          cin>>n2;

          max=maximo(n1,n2);

          cout<<"El nemero mayor es:"<<max;

}

                                    CODIFICACION Nº 14

PROGRAMA DE DATOS DE MIS AMIGOS CON FUNCIONES

#include<stdio.h>

#include<iostream.h>

#define n 3



struct agenda

{

     char nombre[25];

          char telefono[10];

          int edad;

          };



struct agenda a[n];
void main()

{

        for(int i=0;i<n;i++)

    {

        cout<<"Ingrese nombre: ";

        cin>>a[i].nombre;

        cout<<"Ingrese edad: ";

        cin>>a[i].edad;

        cout<<"Ingresar telefono: ";

        cin>>a[i].telefono;

        }

        for(int j=0;j<n;j++)

        {

        cout<<"El nombre es "<<a[j].nombre;

        cout<<" su edad es "<<a[j].edad;

        cout<<" y su telefono es "<<a[j].telefono<<endl;

        }

}

                                       CODIFICACION Nº 15

//programa del numero mayor con funcion

#include<stdio.h>

#include<iostream.h>

#include<conio.h>



int maximo()

{
int n1, n2;

int max;

cout << "Ingrese n1: ";

cin>>n1;

cout << "Ingrese n2: ";

cin>>n2;

max=(n1,n2);

if(n1>n2)

max=n1;

else

max=n2;

return max;

};



int main()

{

int max;

max=maximo();

cout<<"El numero mayor es:"<< max;

}

                                     CODIFICACION Nº 16

//programa de datos de una persona

#include <stdio.h>

#include <conio.h>

#include <iostream.h>



int telefono(int, int);
int edad(int, int);

int res, res3,res2;

int r,r3,r2;

void main()

{




         char nom[50];

         char nom1[30];

         int i;int j;

         int n1,n2,res2,res1,res3;

         cout<<"programa de datos de una persona "<<endl;

         int e1,e2,r2,r1,r3;

         int d1,d2,m1,m2,m3;

         for (i=1;i<=2;i++)

         {

         cout<<"ingrese nombre "<<endl;

         }

gotoxy(20,2);

cin>>nom;

gotoxy(20,3);

cin>>nom1;

res1=telefono(n1,n2);

res3=telefono(n1,n2);

r1=edad(e1,e2);

r3=edad(e1,e2);
}

int telefono(int n1,int n2)

{

          cout<<"ingrese telefono: ";

cin>>n1;

res=n1;

return(res);

cout<<"ingrese telefono 2: ";

cin>>n2;

res2=n2;

return(res3);

}

int edad(int e1,int e2)

{

          cout<<"ingrese edad: ";

cin>>e1;

r=e1;

return(r);

cout<<"ingrese edad 2 ";

cin>>e2;

r2=e2;

return(r2);

          getch();

}

                                        CODIFICACION Nº 17

//PROGRAMA QUE INGRESA NUMEROS LOS VECTORES Y SUMA LOS NUMEROS PARES

#include <iostream.h>
#include <conio.h>

#include <stdio.h>

void main()

{

       int par[10];

       int impar[10];

       int i; int j;int x;int num;int sumapares;

       sumapares=0;

       for (i=1;i<=10;i++)

       {

                  cout<<"ingrese un numero:"<<i<<endl;

                  cin>>num;

                  par[i]=num;

       }

       cout<<"El Contenido del vector es:"<<endl;

       for        (j=1; j<=10;j++)

                  cout<<par[j]<<endl;

       getch();

       for        (x=1;x<=10;x++)

                  if (par[x]%2==0)

                          sumapares=sumapares+par[x];

       cout<<"La suma de los numeros pares es:"<<sumapares<<endl;

       getch();

}

                                        CODIFICACION Nº 18

//PROGRAMA QUE INGRESA ELEMENTOS EN UN VETOR

#include <iostream.h>
#include <conio.h>

#include <stdio.h>

void main()

{

        int num[20]

        int i;int j;

        for (i=0;i<=5;i++)

        {

                           cout<<i<<endl;

        }

        cout<<"Elementos ingresados:"<<i<<endl;

        getch();

}

                                            CODIFICACION Nº 19

//PROGRAMA LA FRASE

//AUTOR LUIS DAQUILEMA 6to INFORMATICA

#include <iostream.h>

#include <conio.h>

#include <string.h>

int main()

{

        int ma=0,me=0,mi=0,mo=0,mu=0,s=0,t,ar;

        char frase[40];

{

                   clrscr();

                   cout<<"ingrese la frase:"<<endl;

                   cin.getline(frase,40);
t=strlen(frase);

        cout<<"La frase tiene"<<endl;

for(int c=0;c<39;c++)

{

        if (frase[c]=='a')

                             ma++;

                             else

                                        if (frase[c]=='e')

                                                 me++;

                                                 else

                                                 if(frase[c]=='i')

                                                             mi++;

                                                             else

                                                             f (frase[c]=='o')

                                                                     mo++;

                                                                     else

                                                                     if (frase[c]=='u')

                                                                                 mu++;

                                                                                 else

                                                                                 if(frase[c]==' ')

                                                                                          s++;

}

cout<<"el total A:"<<ma<<endl;

cout<<"el total E:"<<me<<endl;

cout<<"el total I:"<<mi<<endl;

cout<<"el total O:"<<mo<<endl;

cout<<"el total U:"<<mu<<endl;
cout<<"el total de espacios en blanco"<<s<<endl;

}

getch();

}




                                           CODIFICACION Nº 20

//PROGRAMA METODO DE LA BURBUJA

#include <iostream.h>

#include <math.h>

#include <stdlib.h>

void main()

{

        int i,m,j,a[10];



        cout<<"METODO DE LA BURBUJA (forma descendente)"<<endl;

        for(i=0;i<10;i++)

        {

        cout<<"CAPTURANDO"<<"["<<i<<"] : ";cin>>a[i];

        }

for(i=0;i<10;i++)

        {

                 for(j=0;j<10-1;j++)

                 {

                           if(a[i]>a[j])

                           {
m=a[i];

                  a[i]=a[j];

                  a[j]=m;

                            }

                  }

       }

       cout<<"numeros ordenados";

       for(i=0;i<10;i++)

       {

                  cout<<"A["<<i<<"] : "<<a[i];

       }

       getch();

}

                                         CODIFICACION Nº 21

//PROGRAMA DE LA TABLA DE MULTIPLICAR DEL 5 YA INGRESADOS

#include <iostream.h>

#include <conio.h>

void main()

{

       int a[10],b[10],c[10],i;

       i=5;

       for(int j=0;j<11;j++)

                  {

                            c[10]=i*j;

                            cout<<i<<" x "<<j<<" * "<<c[10]<<endl;

                  }

       getch();
}

                                        CODIFICACION Nº 22

//programa que ordena de mayor a menor

#include <iostream.h>

#include <conio.h>

#include <stdio.h>

void main()

{

       int vet[10],i,j,numero,aux;

       cout<<"ingrese los numeros:"<<endl;

       for(i=0;i<10;i++)

       {

               cin>>numero;

               vet[i] = numero;

       }

       cout<<"los nuemros desordenados son"<<endl;

       for(i=0;i<10;i++)

       {

               cout<<vet[i]<<endl;

       }

       cout<<"los numeros ordenados son "<<endl;

       for(i=0;i<9;i++)

        for(j=i+1;j<10;j++)

        {

               if(vet[i]<vet[j])

               {

                          aux=vet[i];
vet[i]=vet[j];

                          vet[j]=aux;

                   }

        }

       for(i=0;i<10;i++)

        cout<<vet[i]<<endl;

       getch();

       clrscr();

}

                                           CODIFICACION Nº 23

//programa que ordena de menor a mayor

#include <iostream.h>

#include <conio.h>

#include <stdio.h>

void main()

{

       int vet[10],i,j,numero,aux;

       cout<<"ingrese los numeros:"<<endl;

       for(i=0;i<10;i++)

       {

                   cin>>numero;

                   vet[i] = numero;

       }

       cout<<"los nuemros desordenados son"<<endl;

       for(i=0;i<10;i++)

       {

                   cout<<vet[i]<<endl;
}

        cout<<"los numeros ordenados son "<<endl;

        for(i=0;i<9;i++)

        for(j=i+1;j<10;j++)

        {

                    if(vet[i]>vet[j])

                    {

                             aux=vet[i];

                             vet[i]=vet[j];

                             vet[j]=aux;

                    }

        }

        for(i=0;i<10;i++)

        cout<<vet[i]<<endl;

        getch();

        clrscr();

}

                                              CODIFICACION Nº 24



//PROGRAMA PARA ORDENAR LAS LETREAS

#include <iostream.h>

#include <conio.h>

#include <stdio.h>

#include <string.h>

#include <stdio.h>

void ingresarLetras(char letra[])

{
for(int i=0;i<10;i++)

{

cout<<"ingrese letras a ordenar:";

cin>>letra[i];

}

}

void ordenarLetras(char letra[])

{

int t;

for(int i=0;i<10;i++)

for(int j=10-1;j>-1;j--)

if((letra[j-1]>letra[j]))

{

t=letra[j-1];

letra[j-1]=letra[j];

letra[j]=t;

}

}

void reportar(char letra[])

{

cout<<"las letras ordenadas son:";

for(int i=0;i<10;i++)

{

cout<<letra[i]<<"           ";

}

cout<<endl;

}
void main()

{

char letra[10];

ingresarLetras(letra);

ordenarLetras(letra);

reportar(letra);

getch();

}

                         CODIFICACION Nº 25

Codificaciones c++

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