| |

VerySource

 Forgot password?
 Register
Search
Author: yueyutao

Find a dilemma and it took me an afternoon.

[Copy link]

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-15 16:30:01
| Show all posts
maybe:
#define N 30
#include "stdio.h"
#include <math.h>
#include "conio.h"
#include <stdlib.h>

int main ()
{
   int lucky [N] [N], row [N], col [N];
   int n, lucky_n, k, sum = 0, i, j;
   printf ("Please enter the square matrix order"); scanf ("% d",&n);
   printf ("Please enter the lucky number"); scanf ("% d",&lucky_n);
   k = lucky_n / n;
   if (k == 0)
   printf ("The input value is too small");
   for (i = 0; i <n; i ++)
   {
      row [i] = rand ()% k;
      col [i] = rand ()% k;
      sum + = row [i] + col [i];
    }
    col [n-1] + = lucky_n-sum;
    for (i = 0; i <n; i ++)
       for (j = 0; j <n; j ++)
          lucky [i] [j] = row [i] + col [j];
    for (i = 0; i <n; i ++)
    {
       for (j = 0; j <n; j ++)
           printf ("% d\f", lucky [i] [j]);
     }
   getch ();
}
Reply

Use magic Report

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-15 19:30:02
| Show all posts
Come on
Reply

Use magic Report

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-20 16:30:01
| Show all posts
(1) The subprogram sort () directly selects and sorts the linked list. The linked list for sorting does not have a marked node, and the first pointer is provided by the parameter. For convenience of sorting, this function adds an auxiliary header mark node to the linked list before sorting, and deletes this node after sorting is completed.
typedef struct node
{
   int value;
   struct node * next;
} node;

void sort (_______ (1) _______ h) struct node **
{
    struct node * p, * q, * r, * s, * h1;
    h1 = p = (node ​​*) malloc (sizeof (node));
    p-> next = * h;
    while (p-> next)
    {
       q = p-> next;
       r = p;
       while (q-> next)
       {
           if (q-> next-> value <_______ (2) _______) r-> next-> value
              r = q;
           q = q-> next;
        }
        if (r! = q) should be changed to if (r! = p)
        {
            s = _______ (3) _______; h1-> next = r-> next
            _______ (4) _______ = s-> next; r-> next
            s-> next = _______ (5) _______; p-> next
         }
        p = p-> next;
    }
    * h = _______ (7) _______; h1-> next
    free (h1);
}
Reply

Use magic Report

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-20 23:00:01
| Show all posts
The above is wrong, wrong
Reply

Use magic Report

0

Threads

4

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-6-17 14:30:02
| Show all posts
Brothers:
        Help me, my brother has a question about the SPI interception network packet technology. I have intercepted the data packet and put it in the file, but I don't know how to filter the data packet. I wrote it in C++! Experts please give pointers! ! ! thank you very much! ! It’s good to leave a contact, qq or something?
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-6-17 16:30:01
| Show all posts
This program is available in the soft test materials. There is no problem in the title. You can check it and you will know. It is a self-finding on the programmer test paper. I have done it. You have analyzed it yourself.
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-7-4 23:30:01
| Show all posts
Is it elevation or programmer?
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-7-5 07:15:01
| Show all posts
暗夜刺炎:

if(q->next->value <_______(2)_______) r->next->value
If this is the answer, r=q is wrong. r should be equal to the smallest value
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-7-5 16:15:01
| Show all posts
The second question seems not to understand too much!
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-7-11 09:00:01
| Show all posts
I made the second answer in three rows and three columns, but I would like to ask a master. Can you directly output an array of three rows and three columns when outputting the answer. Using pass by reference as array, it seems that it does not work.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list