虫虫首页|资源下载|资源专辑|精品软件
登录|注册

TODO

  • java 线程 静态锁

    java 线程 静态锁,对象锁, synchronized 是锁方法还是锁对象?还是锁类?如何实现?? 部分代码如下, public static Object lock=new Object() //静态锁,锁类,不是锁对象了!!所以两个线程同时 运行两个 TestThread 的execute( ),也可以同步!!! public void execute(){ // synchronized(lock){ for(int i=0 i<20 i++){ try { Thread.sleep(30) } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace() } System.out.println(Thread.currentThread().getName()+Thread.currentThread ().getName()+" "+i) } } }

    标签: java 线程

    上传时间: 2017-07-15

    上传用户:lijianyu172

  • c#简单计算器

    // 学生管理.cpp : Defines the entry point for the application. // #include "stdafx.h" #include "resource.h" #define MAX_LOADSTRING 100 // Global Variables: HINSTANCE hInst; // current instance TCHAR szTitle[MAX_LOADSTRING]; // The title bar text TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text // Foward declarations of functions included in this code module: ATOM MyRegisterClass(HINSTANCE hInstance); BOOL InitInstance(HINSTANCE, int); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM); struct person {   char name[10];   int ID;   int cj_yw;   int cj_sx;   struct person* next;   struct person* pro; }per; int APIENTRY WinMain(HINSTANCE hInstance,                      HINSTANCE hPrevInstance,                      LPSTR     lpCmdLine,                      int       nCmdShow) {   // TODO: Place code here. MSG msg; HACCEL hAccelTable; // Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_MY, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // Perform application initialization: if (!InitInstance (hInstance, nCmdShow))  { return FALSE; } hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MY); // Main message loop: while (GetMessage(&msg, NULL, 0, 0))  { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))  { TranslateMessage(&msg); DispatchMessage(&msg); } } return msg.wParam; } // //  FUNCTION: MyRegisterClass() // //  PURPOSE: Registers the window class. // //  COMMENTS: // //    This function and its usage is only necessary if you want this code //    to be compatible with Win32 systems prior to the 'RegisterClassEx' //    function that was added to Windows 95. It is important to call this function //    so that the application will get 'well formed' small icons associated //    with it. // ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX);  wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_MY); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = (LPCSTR)IDC_MY; wcex.lpszClassName = szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); return RegisterClassEx(&wcex); } // //   FUNCTION: InitInstance(HANDLE, int) // //   PURPOSE: Saves instance handle and creates main window // //   COMMENTS: // //        In this function, we save the instance handle in a global variable and //        create and display the main program window. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) {    HWND hWnd;    hInst = hInstance; // Store instance handle in our global variable    hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,       CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);    if (!hWnd)    {       return FALSE;    }    ShowWindow(hWnd, nCmdShow);    UpdateWindow(hWnd);    return TRUE; } // //  FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // //  PURPOSE:  Processes messages for the main window. // //  WM_COMMAND - process the application menu //  WM_PAINT - Paint the main window //  WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; TCHAR szHello[MAX_LOADSTRING]; LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING); switch (message)  { case WM_COMMAND: wmId    = LOWORD(wParam);  wmEvent = HIWORD(wParam);  // Parse the menu selections: switch (wmId) { case IDM_ABOUT:   DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);   break; case IDM_EXIT:   DestroyWindow(hWnd);   break; default:   return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... RECT rt; GetClientRect(hWnd, &rt); DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER); EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam);    }    return 0; } // Mesage handler for about box. LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)  { EndDialog(hDlg, LOWORD(wParam)); return TRUE; } break; }     return FALSE; }

    标签: 计算器 学生

    上传时间: 2016-12-29

    上传用户:767483511

  • 简单的计算器

    // 学生管理.cpp : Defines the entry point for the application. // #include "stdafx.h" #include "resource.h" #define MAX_LOADSTRING 100 // Global Variables: HINSTANCE hInst; // current instance TCHAR szTitle[MAX_LOADSTRING]; // The title bar text TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text // Foward declarations of functions included in this code module: ATOM MyRegisterClass(HINSTANCE hInstance); BOOL InitInstance(HINSTANCE, int); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM); struct person {   char name[10];   int ID;   int cj_yw;   int cj_sx;   struct person* next;   struct person* pro; }per; int APIENTRY WinMain(HINSTANCE hInstance,                      HINSTANCE hPrevInstance,                      LPSTR     lpCmdLine,                      int       nCmdShow) {   // TODO: Place code here. MSG msg; HACCEL hAccelTable; // Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_MY, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // Perform application initialization: if (!InitInstance (hInstance, nCmdShow))  { return FALSE; } hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MY); // Main message loop: while (GetMessage(&msg, NULL, 0, 0))  { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))  { TranslateMessage(&msg); DispatchMessage(&msg); } } return msg.wParam; } // //  FUNCTION: MyRegisterClass() // //  PURPOSE: Registers the window class. // //  COMMENTS: // //    This function and its usage is only necessary if you want this code //    to be compatible with Win32 systems prior to the 'RegisterClassEx' //    function that was added to Windows 95. It is important to call this function //    so that the application will get 'well formed' small icons associated //    with it. // ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX);  wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_MY); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = (LPCSTR)IDC_MY; wcex.lpszClassName = szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); return RegisterClassEx(&wcex); } // //   FUNCTION: InitInstance(HANDLE, int) // //   PURPOSE: Saves instance handle and creates main window // //   COMMENTS: // //        In this function, we save the instance handle in a global variable and //        create and display the main program window. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) {    HWND hWnd;    hInst = hInstance; // Store instance handle in our global variable    hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,       CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);    if (!hWnd)    {       return FALSE;    }    ShowWindow(hWnd, nCmdShow);    UpdateWindow(hWnd);    return TRUE; } // //  FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // //  PURPOSE:  Processes messages for the main window. // //  WM_COMMAND - process the application menu //  WM_PAINT - Paint the main window //  WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; TCHAR szHello[MAX_LOADSTRING]; LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING); switch (message)  { case WM_COMMAND: wmId    = LOWORD(wParam);  wmEvent = HIWORD(wParam);  // Parse the menu selections: switch (wmId) { case IDM_ABOUT:   DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);   break; case IDM_EXIT:   DestroyWindow(hWnd);   break; default:   return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... RECT rt; GetClientRect(hWnd, &rt); DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER); EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam);    }    return 0; } // Mesage handler for about box. LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)  { EndDialog(hDlg, LOWORD(wParam)); return TRUE; } break; }     return FALSE; }

    标签: 学生 计算器

    上传时间: 2016-12-29

    上传用户:767483511

  • java学生数据库

    /*import java.util.Scanner; //主类 public class student122 {   //主方法   public static void main(String[] args){     //定义7个元素的字符数组     String[] st = new String[7];     inputSt(st);       //调用输入方法     calculateSt(st);   //调用计算方法     outputSt(st);      //调用输出方法   }   //其他方法   //输入方法 private static void inputSt(String st[]){     System.out.println("输入学生的信息:");   System.out.println("学号 姓名 成绩1,2,3");   //创建键盘输入类   Scanner ss = new Scanner(System.in);   for(int i=0; i<5; i++){     st[i] = ss.next(); //键盘输入1个字符串   } }   //计算方法 private static void calculateSt(String[] st){   int sum = 0;         //总分赋初值 int ave = 0;         //平均分赋初值 for(int i=2;i<5;i++) {   /计总分,字符变换成整数后进行计算   sum += Integer.parseInt(st[i]); } ave = sum/3;         //计算平均分 //整数变换成字符后保存到数组里 st[5] = String.valueOf(sum); st[6] = String.valueOf(ave); }   //输出方法 private static void outputSt(String[] st){     System.out.print("学号 姓名 ");   //不换行   System.out.print("成绩1 成绩2 成绩3 ");   System.out.println("总分 平均分");//换行   //输出学生信息   for(int i=0; i<7; i++){     //按格式输出,小于6个字符,补充空格     System.out.printf("%6s", st[i]);   }   System.out.println();            //输出换行 } }*/   import java.util.Scanner;   public class student122 {   public static void main(String[] args) { // TODO 自动生成的方法存根 String[][] st = new String[3][8]; inputSt(st); calculateSt(st); outputSt(st); }   //输入方法 private static void inputSt(String st[][]) { System.out.println("输入学生信息:"); System.out.println("班级 学号 姓名 成绩:数学 物理 化学"); //创建键盘输入类 Scanner ss = new Scanner(System.in); for(int j = 0; j < 3; j++) { for(int i = 0; i < 6; i++) { st[j][i] = ss.next(); } } } //输出方法 private static void outputSt(String st[][]) { System.out.println("序号 班级 学号 姓名 成绩:数学 物理 化学 总分 平均分"); //输出学生信息 for(int j = 0; j < 3; j++) { System.out.print(j+1 + ":"); for(int i = 0; i < 8; i++) { System.out.printf("%6s", st[j][i]); } System.out.println(); } }     //计算方法     private static void calculateSt(String[][] st)     {      int sum1 = 0;      int sum2 = 0; int sum3 = 0;      int ave1 = 0;      int ave2 = 0;      int ave3 = 0;      for(int i = 3; i < 6; i++)      {      sum1 += Integer.parseInt(st[0][i]);      }      ave1 = sum1/3;           for(int i = 3; i < 6; i++)      {      sum2 += Integer.parseInt(st[1][i]);      }      ave2 = sum2/3;           for(int i = 3; i < 6; i++)      {      sum3 += Integer.parseInt(st[2][i]);      }      ave3 = sum3/3;           st[0][6] = String.valueOf(sum1);      st[1][6] = String.valueOf(sum2);      st[2][6] = String.valueOf(sum3);      st[0][7] = String.valueOf(ave1);      st[1][7] = String.valueOf(ave2);      st[2][7] = String.valueOf(ave3);     } }

    标签: java 数据库

    上传时间: 2017-03-17

    上传用户:simple

  • 在VS(VC)2010中使用MSComm控件实现串口通信的详细步骤

    1.安装好VS2010,网上很多人说使用VC6.0的mscomm32.ocx控件,下载并注册,注册过程看上去还很复杂。我是使用VS2010自带的控件,因此没有这些过程,只需要安装好V52010就行了。2.建立“基于对话框”的MFC工程,命名为CommTest,应用程序类型选择“基于对话框”3.删除默认的“确定”,“取消”按钮和静态文本框“TODO在此放置对话框控件”,添加如下对话框控件:①“打开串口”按钮,添加方法为从右侧“工具箱”拖放一个“Button”到对话框,并在右侧“属性”卡中修改“Caption”为“打开串口”,修改“I0”为“IDC_BUTTON_OPEN”。②“关闭串口”按钮,添加方法为从右侧“工具箱”拖放一个“Button”到对话框,并在右侧“属性”卡中修改“Caption”为“关闭串口”,修改“ID”为“IDC_BUTTON_CLOSE”。③“发送”按钮,添加方法为从右侧“工具箱”拖放一个“Button”到对话框,并在右侧“属性”卡中修改“Caption”为“发送”,修改“ID”为“IDC_BUTTON_SEND”。④“发送编辑框”。⑤“接受编辑框”

    标签: MSComm 串口通信

    上传时间: 2022-06-30

    上传用户:shjgzh

  • 123个微信小程序开发源码合集

    AppleMusic - B站首页界面设计:附详细教程 - cnode社区版 - dribbble - FlexLayout布局 - gank - HIapp - IT-EBOOK - leantodu - LOL战绩查询 - movecss效果 - Railay:整体框架 - redux绑定 - TCP,IP长连接 - TODO list - v2ex - 一个(仿) - 一元夺宝主页设计 - 万年历 - 下拉刷新,tab切换 - 东航订机票 - 事项助手 - 二维码生成器 - 云笔记 - 五十音图 - 五险一金计算 - 人脸检测 - 今日头条 - 仿微信DEMO - 仿找事吧 - 仿网易云音乐 - 会议精灵 - 你画我猜 - 侧滑布局 - 健康菜谱 - 全屏动画滚动 - 内容说明.txt 527B 分答小程序 - 创客+实现大量功能,推荐研究 - 剪刀石头布 - 医药网 - 卡卡汽车 获取用户 设备信息 - 同乐居商城:购物车合算 - 商城 - 图书管理系统 - 图文信息;欢迎页面,音乐控制 - 图片自适应 ,富文本解析 - 圆形菜单 - 城市切换 - 备忘录 - 外卖:实现类似锚点功能 - 大转盘 - 天气预报 - 妈妈课堂 - 家居电商 - 富文本解析,折线图,MD5,bluebird - 小游戏-别踩白块 - 小熊的日记 - 小程序地图定位 - 小程序完整demo:飞翔的小鸟:canvas实现,java后端(适用1221) - 小程序官方Demo - 小程序版2048 - 小程序统计[只需一行代码].url 132B 小程序页面生成器 - 康爱多微商城:学习界面设计 - 微票 - 我厨 tab 界面设计 - 手势解锁 - 掘金首页信息流 - 摇一摇换文章 - 教务系统 - 新浪读书 - 新闻客户端 - 易打卡 表单设计 - 星巴克中国 - 智能机器人 - 机器人兔兔 - 极客学院 - 果库 - 查拼音 - 校内新闻大图 - 框架 - 步步高字典 - 水浒传 - 治疗师 - 涂鸦 - 滑动选项卡 - 滴滴公交-查公交 - 瀑布流布局 - 用户反馈组件 - 电商-拼团 倒计时 - 电影推荐 - 电影日历 - 画布:时钟 - 番茄时钟 - 百度小说 - 相册;处理用户信息 - 省市选择控件 - 知乎 - 知乎日报 - 知乎日报1 - 科学计算器 - 移动小商城:基于node,包含前后台 - 移动端商城 - 简易计算器 - 网易云课堂 - 腾讯云小程序一站式解决方案 - 自定义tabbar - 芒果TV - 语音跟读 - 豆瓣图书 - 豆瓣电影 - 货币汇率 - 购物车 - 跑步 地理位置 计时器 - 身份证查询 - 车源宝 - 轮播图+菜单 - 轮播图变换 - 辩论倒计时 - 重邮 - 题库:选择选项,切换至下一题 - 首字母排序选择 - 高仿苹果计算器

    标签: Visual 2008

    上传时间: 2013-06-12

    上传用户:eeworm