Thread: transpos

  1. #1
    Registered User
    Join Date
    Mar 2013
    Location
    iran
    Posts
    2

    Post transpos

    help me please.what is wrong in this code?



    Code:
    
    #include<iostream>
    using namespace std;
    const int size=3;                        
    void read(int a[size][size])
    {
    cout<<"enter"<<size*size<<"numbers"<<size<<"rows"<<endl; 
    for(int i=0;i<size;i++){
    cout<< "row"<<i<<":";
    for(int j=0;j<size;j++)
    cin>>a[i][j];
    }}
    void trans(int at[size][size],int a[size][size])
    {
    int i,j;
    at[j][i]=a[i][j];
    for(int i=0;i<size;i++){
    for(int j=0;j<size;j++){
    cout<< "radif"<<j<<":";
    cout<<at[j][i];
    }}
    cout<<endl;
    }
    int main()
    {
    int a[3][3],at[3][3];
    read(a);
    trans(a,at);
    trans(a,at);
    return 0;
    }

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It's really hard to see when you don't indent properly.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Also here, but not noticeably any improvement.
    problem in Program to find Transpose of Given Square Matrix

    @nazanin.padekan
    Fix the indentation, then post it in your original thread.
    This is closed.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed