Matriz

BY
JOSE MIGUEL BRICEÑO
WWW.M3TALIJOX.ES.TL
bueno aqui una matriz que quedara con valores 1 y 0


1  0  1  0  1  0
0  1  0  1  0  1
1  0  1  0  1  0


#include<iostream.h>

void main()

{
    float m[100][100];
    int i, j;

    cout<<"n Ingreza la cantidad de columnas: ";
    cin>>i;
    cout<<"n Ingreza la cantidad de filas: ";
    cin>>j;
    for(int c=0;c<i;c++)    //for para las columnas//
    {
        for(int f=0;f<j;f++)   //for para las filas//
        {
            if((c+f)%2==0)      //condicion q hacen q sean 1 y 0//
            {
                m[c][f]=1;
            }
            else
            {
                m[c][f]=0;
            }
        }
    }
    for(c=0;c<i;c++)
    {
        cout<<"n";
        for(int f=0;f<j;f++)
        {
            cout<<""<<m[c][f];
            cout<<" t";
        }
    }

    cin.get();
    cin.get();
}

Este sitio web fue creado de forma gratuita con PaginaWebGratis.es. ¿Quieres también tu sitio web propio?
Registrarse gratis