Natural selection is testing this #Altcoins season 🌊. In this cycle, many are once again diving deep into research, searching for “the best” after Bitcoin & @Joseinnewworld makes waves 124 #NFTs — Wow, a strong signal for those still weighing their moves. #eCash $XEC #CryptoNews pic.twitter.com/GB3dRvH01U
— NFToa (@nftoa_) September 26, 2025
Case study:
Create a C++ program by implementing a 2-dimensional array in a matrix to sort numbers by column!
Solution:
Source code:
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
#include <iomanip.h>
/**
*bundet.com
*Array 2 Dimensi Matrix Urut Kolom
*/
void main()
{
int matrix[10][10];
int tampung[10];
randomize();
for(int i=0;i<10;i++)
for(int j=0;j<10;j++)
matrix[i][j]=random(20);
for(int i=0;i<10;i++)
{
for(int j=0;j<10;j++)
cout<<setw(5)<<matrix[i][j];
cout<<endl;
}
int x=0;
//menampung baris ke-0...
for(int b=0;b<10;b++)
{
for(int i=0;i<10;i++)
for(int j=0;j<10;j++)
if(j==b)
{
tampung[x]=matrix[i][j];
x++;
}
//mengurutkan nilai di tampung
int tamp;
for(int i=0;i<10;i++)
for(int j=0;j<10;j++)
if(tampung[i]<tampung[j])
{
tamp=tampung[i];
tampung[i]=tampung[j];
tampung[j]=tamp;
}
int a=0;
for(int i=0;i<10;i++)
for(int j=0;j<10;j++)
if(j==b)
{
matrix[i][j]=tampung[a];
a++;
}
a=0;x=0;
}
//endfor
cout<<"\nMatrix setelah diurutkan perkolom adalah:\n";
for(int i=0;i<10;i++)
{
for(int j=0;j<10;j++)
cout<<setw(5)<<matrix[i][j];
cout<<endl;
}
getch();
}Hope this is useful & happy learning!
