#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
srand(time(0));
int table99[3][3]={{1,2,3},{4,5,6},{7,8,9}
};
int i,j,k=0;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
int rnd = rand()%(9-k)+k;
int m=rnd/3;
int n=rnd%3;
int temp =table99[i][j];
table99[i][j]=table99[m][n];
table99[m][n]=temp;
k++;
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%d ",table99[i][j]);
}
printf("\n");
}
return 0;
}
2020年2月11日 星期二
訂閱:
張貼留言 (Atom)
algorithm
#include <iostream> #include <string.h> using namespace std; int main(int argc, char** argv) { for(int j=2;j<=100;j++)//j...
-
本文旨在補充《 超圖解Arduino互動設計入門 》第18章「RFID無線識別裝置與問答遊戲製作」單元,書本採用的RFID讀卡機模組是採用9600bps, TTL序列通訊介面,RFID的通訊頻率為125KHz。這種模組的接線和程式都很簡單,每當感測到RFID卡,讀卡機就把...
-
3.Keil C 幫我們寫好 程式:#include <reg51.h> vs c語言 #include <stdio.h> //幫您宣告 P0=0x80 有相對的記憶體以十六進位表示,它定義定reg51.h,我們直接拿來用他的代碼即可 P1=0...
-
四位數七段顯示器 如果不想要自行接線路,那麼市面上有已經銜接好的二合一、四合一等各種位數的七段顯示器,以四合一的七段顯示器為例,由於每個七段顯示器會需要 8 個腳位控制其上的 LED,再加上各 4 個共陰或共...
沒有留言:
張貼留言