Can't Copy and Paste this?

Click here for a copy-and-paste friendly version of this code!

 

//**************************************

//     

//INCLUDE files for :Matrix rotate and r

//     eflect

//**************************************

//     

#include 

#include 

 

code:

Can't Copy and Paste this?

Click here for a copy-and-paste friendly version of this code!

 

Terms of Agreement:   

By using this code, you agree to the following terms...   

1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for langauges that allow it) freely and with no charge.   

2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   

3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 

4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.  

#include 

#include 

void main()

    {

     clrscr();

     int r,c,a[5][5],b[5][5],d[5][5];

     for (r=0;r<5;r++)

     for(c=0;c<5;c++)

     a[r][c]=r*5+c+1;

    //output array a

    cout<

    for(r=0;r<5;r++)

        {

         for (c=0;c<5;c++)

             {

             if(a[r][c]<10)

             cout<< " " << a[r][c] <<" ";

             else

             cout<

             }

             cout<

        }

        int choice;

        cout<< "\nPick an angle of rotation \n";

        cout<< "1 - 90 degrees\n";

        cout<< "2 - 180 degrees\n";

        cout<< "3 - 270 degrees\n";

        cin>>choice;

        if (choice==1)

            {

             //fill array b, turn array a 90 degrees

             for (r=0;r<5;r++)

             for (c=0;c<5;c++)

             b[4-c][r]=a[r][c];

        }

        if (choice==2)

            {

             //fill array b, turn array a 180 degrees

             for (r=0;r<5;r++)

             for (c=0;c<5;c++)

             b[4-r][4-c]=a[r][c];

        }

        if (choice==3)

            {

             //fill array b, turn array a 270 degrees

             for (r=0;r<5;r++)

             for (c=0;c<5;c++)

             b[c][4-r]=a[r][c];

        }

        cout<

        for (r=0;r<5;r++)

            {

             for (c=0;c<5;c++)

                 {

                 if(b[r][c]<10)

                 cout<< " " << b[r][c] <<" ";

                 else

                 cout<

                 }

                 cout<

            }

            int choice2;

            cout<< "\nPick an angle of reflection and point\n";

            cout<< "1 - x-axis\n";

            cout<< "2 - y-axis\n";

            cout<< "3 - Point\n";

            cin>>choice;

            if (choice==1)

                {

                 //fill array d, reflect array

                 for (r=0;r<5;r++)

                 for (c=0;c<5;c++)

                 d[r][c]=b[4-r][c];

            }

            if (choice==2)

                {

                 //fill array b, turn array a 180 degrees

                 for (r=0;r<5;r++)

                 for (c=0;c<5;c++)

                 d[r][c]=b[r][4-c];

            }

            if (choice==3)

                {

                 //fill array b, turn array a 180 degrees

                 for (r=0;r<5;r++)

                 for (c=0;c<5;c++)

                 d[r][c]=b[4-r][4-c];

            }

            cout<

            for (r=0;r<5;r++)

                {

                 for (c=0;c<5;c++)

                     {

                     if(d[r][c]<10)

                     cout<< " " << d[r][c] <<" ";

                     else

                     cout<

                     }

                     cout<

                }

            }