1 / 6

ARREGLOS BIDIMENSIONALES

ARREGLOS BIDIMENSIONALES. Ing. Betty Suárez Torres. CONCEPTOS BÁSICOS. Una matriz es un array de 2 dimensiones. Declaración: int m[6][10]; Array bidimensional de 6 ×10 enteros ( matriz ) float arr[3][2][5]; Array tridimensional de 3×2×5 reales ( cubo ). Ejemplo 01 #include <stdio.h>

wattan
Download Presentation

ARREGLOS BIDIMENSIONALES

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ARREGLOS BIDIMENSIONALES Ing. Betty Suárez Torres

  2. CONCEPTOS BÁSICOS Una matriz es un array de 2 dimensiones. Declaración: int m[6][10]; Array bidimensional de 6 ×10 enteros (matriz) float arr[3][2][5]; Array tridimensional de 3×2×5 reales (cubo)

  3. Ejemplo 01 #include <stdio.h> #define FILAS 2 #define COLUMNAS 3 void main() { float matriz[FILAS][COLUMNAS]; for(i=0;i<FILAS;i++){ for(j=0;j>COLUMNAS;j++){ printf(“Matriz [%d][%d]:”,i,j); scanf(“%d”,&matriz[i][j]); } } for(i=0;i<FILAS;i++){ for(j=0;j>COLUMNAS;j++){ printf("El valor de Matriz[%d][%d] es %d\n", fil,col,matriz[fil][col]); }

  4. ARREGLOS BIDIMENSIONALES: OPERACIONES BÁSICAS CON MATRICES

  5. MÉTODOS DE BÚSQUEDA DE DATOS EN MATRICES: BÚSQUEDA SECUENCIAL

  6. #include <iostream> #include <conio.h> using namespace std; void main (void) { int posf,posc; int a[50][50],n,i,j,x,f,c; cout<<"INGRESAR EL NUMERO DE FILAS DE LA MATRIZ: "; cin>>f; cout<<endl; cout<<"INGRESAR EL NUMERO DE COLUMNAS DE LA MATRIZ: "; cin>>c; cout<<endl; for(i=0;i<f;i++){ for(j=0;j<c;j++){ cout<<"Ingresar elemento M["<<i+1<<j+1<<"]: "; cin>> a[i][j]; cout<<endl; } } cout<<"INGRESAR ELEMENTO A BUSCAR EN EL ARRAY: "; cin>>x; cout<<endl; for(i=0;i<f;i++){ for(j=0;j<c;j++){ if(a[i][j]==x){ posf=i; posc=j; cout<<endl<<"La posición es: "<<posf+1<<","<<posc+1<<endl; } } } cout<<endl<<"El elemento buscado es: "<<x<<endl; getch(); }

More Related