C++ HW7-3 for WallPower 取得連結 Facebook X Pinterest 以電子郵件傳送 其他應用程式 作者: Dragonyue - 11月 19, 2017 利用C++函式srand()、time(NULL)、rand()產生1~10亂數整數,生成一個有20個元素的陣列,並由使用者輸入一個關鍵值,搜尋在陣列中所有符合的索引值(PS:使用srand()、rand()需載入標頭檔cstdlib,time()需載入標頭檔ctime)。 參考輸出如下圖。 參考答案。 #include <time.h> #include <cstdlib> #include <iostream> using namespace std; int main() { int a[20]; srand(time(NULL)); for (int i = 0; i < 20; i++) a[i] = (rand() % 10) + 1; int input; cout << "請輸入欲搜尋的值(1~20):"; cin >> input; for (int i = 0; i < 20; i++) if (a[i] == input) cout << input << " found at a[" << i << "] = " << input << endl;; system("pause"); return 0; } 取得連結 Facebook X Pinterest 以電子郵件傳送 其他應用程式 留言
C# 井字遊戲 作者: Dragonyue - 1月 07, 2018 開始畫面。 遊戲畫面。 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace CSharp_井字遊戲 { public partial class Form1 : Form { public Form1() { InitializeComponent(); Symbol1_tb.TextChanged += SymbolTextChenge; Symbol2_tb.TextChanged += SymbolTextChenge; Symbol1_tb.MouseClick += Symbol_tb_MouseClick; Symbol2_tb.MouseClick += Symbol_tb_MouseClick; } private void Symbol_tb_MouseClick(object sender, MouseEventArgs e) { TextBox tb = sender as TextBox; tb.SelectAll(); } private void SymbolTextChenge(object sender, EventArgs e) { TextBox tb = sender as TextBox; if (tb.TextLength >= 2) { tb.SelectAll(); ... 閱讀完整內容
Sandboxie - 在沙盤中執行遊戲多開或其他程式 作者: Dragonyue - 9月 30, 2017 將想要在沙盤中執行的軟體上按右鍵,點從沙盤中開啟,也可以直接將程式拖曳進沙盤主控台中開啟。 (有些遊戲會檢測是不是在沙盤中執行,所以不一定能成功開啟。) 閱讀完整內容
C# 輸入兩點並劃出直線(X、Y只顯示-10~10) for 大偉 作者: Dragonyue - 11月 30, 2017 使用者輸入兩點座標,並畫出直線(X、Y只顯示-10~10)。 執行結果。 參考答案。 閱讀完整內容
留言
張貼留言