Latihan Array 2 Dimensi
Latihan Array 2 Dimensi
Latihan Array 2 Dimensi
#include <iostream.h>
#include <conio.h>
int main()
char nama[100][100];
int nilai[100];
int no;
cin>>no;
//input data
cin>>nama[i];
cin>>nilai[i];
//menampilkan data
cout<<"tampilkan data"<<endl;
getch();
}
PART 2
#include <stdio.h>
int main(void)
{
int bilangan[2][2];
bilangan[0][0] = 100;
bilangan[0][1] = 101;
bilangan[1][0] = 110;
bilangan[1][1] = 111;
printf("Isi array bilangan: \n");
printf("%d, %d \n",bilangan[0][0],bilangan[0][1]);
printf("%d, %d \n",bilangan[1][0],bilangan[1][1]);
return 0;
}
PART 3
#include <stdio.h>
int main(void)
{
int matrix[2][3] = {{1,2,3},{7,8,9}};
printf("Isi array matrix: \n");
printf("%d %d %d \n", matrix[0][0], matrix[0][1], matrix[0][2]);
printf("%d %d %d \n", matrix[1][0], matrix[1][1], matrix[1][2]);
return 0;
}
PART 4
#include <iostream.h>
#include <conio.h>
int main(){
int x,y,a[3][4],b[3][4];
for (x=0;x<=2;x++){
for (y=0;y<=3;y++){
for (x=0;x<=2;x++){
for (y=0;y<=3;y++){
cin>>b[x][y];
for (x=0;x<=2;x++){
cout<<endl;
for (y=0;y<=3;y++){
cout<<a[x][y]+b[x][y]<<" ";
getch();
PART 5
#include <iostream.h>
#include <conio.h>
int main()
cin >> m;
cin >> n;
getch();