Array Change

Posted by Didi Setyapramana On 9:57 PM 0 komentar

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    int b[10][10];
    int n,x,y,m;
    int a[10];
    
    cout<<"Masukan angka:";
    cin>>n;
    for(x=0;x<n;x++)
    for(y=0;y<n;y++)
    {
        cout<<"Data["<<x+1<<"]["<<y+1<<"]:";
        cin>>b[x][y];
    }
    
    x=0;
    while(x<n)
    {
        y=0;
        while(y<n)
        {
            m=x*n+y;
            a[m]=b[x][y];
            y++;
            cout<<" "<<a[m];
        }
     cout<<endl;
     x++;
     }    
     
    system("PAUSE");
    return EXIT_SUCCESS;
}

Categories: ,

0 Response for the "Array Change"

Post a Comment