How to write a matrix rotation problem in C

Updated on technology 2024-05-08
7 answers
  1. Anonymous users2024-02-09

    #include

    #include

    #define n 9

    void main()

    int m,a[n][n];

    char ch1,ch2;

    int i=0,j=0;

    int n=1,p=0;l: do

    The original author did not write the logical words in the conditional statement, resulting in compilation errors, which have all been modified and can be run directly, and this **effect is not a rotation matrix, but a matrix, which is composed of outward to inward rotation.

  2. Anonymous users2024-02-08

    You can write an arbitrary order with a pointer...

    Do you want to be clockwise or counterclockwise.

  3. Anonymous users2024-02-07

    Do you want to be counterclockwise or clockwise.

    Clockwise, transpose it, flip it horizontally and you're good to go.

    Counterclockwise, transpose it, flip it vertically, and you're good to go.

    #include

    #include

    #define n 4

    void show(int a[n][n])printf("");

    printf("--");

    int main()

    show(a);

    for (i = 0; i < n; i++)show(a);

    This is a clockwise horizontal flip, note that it cannot run at the same time as the vertical flip below, otherwise it will be flipped horizontally and vertically again.

    for (i = 0; i < n; i++)show(a);*/

    for (i = 0; i < n; i++)show(a);

    return 0;}

  4. Anonymous users2024-02-06

    Hello landlord!

    This is a matrix transpose problem, according to the definition of transpose as follows:

    The matrix a is transposed to such an n m matrix b satisfying b = a(j,i), i.e. b (i,j) = a (j,i) (the i-row j-column elements of b are the i-column i-column elements of a).

    Therefore, according to the definition, the part is changed as follows: (change the original i to j, the original j to i, num[i][n-1] to num[n-1][j], the specific reference is as follows**).

    for(int i=0;iThe above paragraph is changed to the following paragraph!

  5. Anonymous users2024-02-05

    void rotatearr(){

    int temp[row][col], i, j, k;

    for (i=0,j=col-1; j>=0; i++,j--)for (k=0; ktemp[k][j] = arr[i][k];temp is used as a temporary array to store the ARR array after 90 degrees flipping.

    for (i=0; ifor (j=0; jprintf("%5d",arr[i][j] = temp[i][j]);The contents of the temp array are assigned to the arr array one by one to change the value of the arr array, so that the value of arr will change continuously when the rotatearr function is called multiple times.

    printf("");

    printf("");

  6. Anonymous users2024-02-04

    Two-dimensional arrays, you just think of the arrays in the array as convenient, don't look at the source code, think of it yourself to remember clearly.

  7. Anonymous users2024-02-03

    Take the math formula and you're done. This question is not about C++ programs, but about mathematics.

Related questions
8 answers2024-05-08

If you just make a separate app (instead of engaging in the secondary development of the framework), qt can barely make up the number. Although it is not pure C++ (relying on MOC QML), the overall tools (build tools, designers, IDE integration including VS) are relatively high, and they also support multiple mainstream platforms (Windows, Linux, OS X, etc.), with relaxed license requirements (LGPL), optional commercial support, and relatively low risk for individual APP projects. Although the binary size that needs to be released is still on the large side, it is easier to do than the mainstream web and. >>>More

8 answers2024-05-08

Isn't it over if you do a division of seconds?

10 answers2024-05-08

1 First of all, click [File] and select [New] to select [C++ Source File] in the file, enter the [File Name] to be created, and select the location of the file to be saved] is [browsing] Knowledge: The shortcut key for [New Deslag Removal File] is [Ctrl+N] 2 Next, you can [write a program] in the newly created file After the writing is completed, click [Compile [File Name]] in [Component (B)] Tips: The file name is as shown in the following figure [Nazhen quietly has a small asterisk, indicating that there is an unsaved part in the file, so at this time, you can press the shortcut key [Ctrl+S] to save the file.

10 answers2024-05-08

arp packages can be used in ms's platformsdk in ip helper dword sendarp (ipaddr destip, ipaddr srcip, pulong pmacaddr, pulong phyaddrlen); >>>More

14 answers2024-05-08

It's easy to see the matrix symmetry, so just find the minimum value of the sum of columns or rows, and look at the graph to mean that in xls, give you a reference program, a=xlsread('filename');%** location. >>>More