C++程序设计
王焕龙
Hello world!
展开
-
Flutter Windows desktop中Dart调用C++代码获取笔记本电量信息
1.flutter_window.h 增加configMethodChannel方法2.flutter_window.cpp文件中#include "flutter_window.h"#include <optional>#include "flutter/generated_plugin_registrant.h"#include "flutter/method_channel.h"#include "flutter/standard_method_co...原创 2021-07-17 22:08:53 · 1324 阅读 · 1 评论 -
C++判断某个进程或者窗口是否存在
#include<iostream>#include<cstdlib>#include<Windows.h>using namespace std;//判断某个窗口是否存在int main() { while (1) { HWND win = FindWindowA("ConsoleWindowClass", "Tomcat"); /...原创 2019-01-10 16:06:51 · 3673 阅读 · 0 评论 -
CGI参数获取后处理以及根据键获取值
#include<iostream>#include <cstring>#include<list>using namespace std;const char *query_string = "para1time=val1&para2=&para3=val3";string getValueByKey(char *t, ...原创 2019-01-25 15:37:57 · 1021 阅读 · 0 评论 -
C++读取读取进程以及相关内存内容,获取游戏血量和真气
#include<iostream>#include<Windows.h>#include<cstdlib>using namespace std;int main() { HWND win = FindWindowA("QElementClient Window", "Element Client"); //获取进程 ...原创 2019-01-26 18:29:13 · 7290 阅读 · 0 评论 -
MFC读取config文件
配置文件characters.config[system]type=0nodename=quote-live3011srvname=mt4cplussrvport=jobthread=16recvthread=32sendthread=32[memcache]redis_db=0quote_tick_hostip=111quote_tick_hostport=11q...原创 2019-02-14 16:47:26 · 658 阅读 · 0 评论 -
MFC中使用WriteProcessMemory向某个程序更改值
// TODO: 在此添加控件通知处理程序代码 HANDLE hProcess; DWORD dwid = 6244; //被写入进程id hProcess = ::OpenProcess(PROCESS_ALL_ACCESS, false, dwid); if (hProcess == NULL) { MessageBoxA(GetSafeHwnd(), "hProcess为空...原创 2019-02-19 19:40:59 · 751 阅读 · 0 评论 -
c++读取数据处理皮尔逊
Pearson.h#pragma once#define M 10#define N 2#define K 2long double calcCov(long double s[], long double t[]){ int i = 0, l = 0; long double mulE = 0, sourceE = 0, dataE = 0; for (i = 0...原创 2019-03-15 18:54:10 · 368 阅读 · 0 评论 -
C++遍历所有当前应用的HWND和标题
#include<Windows.h>#include<iostream>#ifdef _WIN32#include <process.h>#else#include <unistd.h>#endif#include <wchar.h>#include <stdio.h> #include <...原创 2019-03-25 10:40:33 · 1655 阅读 · 2 评论 -
C++文件简单的读写
#include<iostream>#include<fstream>using namespace std;int main() { ofstream out("out.txt"); if (out.is_open()) { out << "This is a line.\n"; out << "This is an...原创 2019-03-25 15:15:25 · 218 阅读 · 0 评论 -
C++调用Lua方法
test.lua文件print("hello lua")width=200height=300weight="this is String"function max(num1,num2 ) if(num1>num2)then return num1 else return num2 end endC++...原创 2019-03-26 11:26:18 · 2301 阅读 · 0 评论 -
C调用py
1.pyimport numpy as npdef pyInput(): a=input() print(a)def data(): matrix=[[0,1,2,3],[1,1,1,1]] print(matrix) #a=input() #print(a) p:int=0 print(p)usePy.c#include<stdlib.h...原创 2019-03-26 15:03:42 · 289 阅读 · 0 评论 -
C++ libxl库读写Excel
#include<iostream>#include<stdio.h>#include <windows.h>#include "libxl.h"using namespace std;using namespace libxl;#pragma comment(lib,"libxl.lib")int main(){ Book* bo...原创 2019-03-26 17:00:32 · 1085 阅读 · 0 评论 -
Lua调用C++方法
test.luawidth=200height=300weight="this is String"function LuaInput() a=io.read(); print(a) endfunction max(num1,num2 ) LuaInput() if(num1>num2)then return num1 ...原创 2019-03-26 20:12:07 · 1832 阅读 · 0 评论 -
C++在MFC中新建线程做个计时器
关键代码#include <time.h>time_t now_time;CString str;struct tm *Ptr;UINT FlashTime(LPVOID LParam){ CTimeTestDlg *pWnd = (CTimeTestDlg *)LParam; pWnd->doFlashTime(); return -1;}vo...原创 2019-03-28 15:46:19 · 935 阅读 · 0 评论 -
MFC中开启控制台个关闭控制台
开启控制台AllocConsole();freopen("CONOUT$","w+t",stdout);关闭控制台fclose(stdout);FreeConsole();原创 2019-04-09 13:41:47 · 1363 阅读 · 3 评论 -
QT网络请求相关
#include "QtGuiApplication4.h"#include <QtNetwork/QNetworkAccessManager>#include <QtNetwork/QNetworkRequest>#include <QtNetwork/QNetworkReply>#include <QUrlQuery >#inclu...原创 2019-06-14 18:06:58 · 416 阅读 · 0 评论 -
NDK环境配置hello
1.新建一个空项目2.新建一个java类以及方法声明package com.example.ndkdemo;public class Hello { static { System.loadLibrary("hello"); } public static native String sayHello();}...原创 2019-08-09 22:18:55 · 213 阅读 · 0 评论 -
C++中Long double数据取精度
#include<iostream>#include <string>#include<math.h>#include <sstream>using namespace std;string do_fraction(long double value, int digits){ long double val1 = value...原创 2018-09-11 10:28:49 · 3899 阅读 · 0 评论 -
C++将double类型转换控制小数位转换为string
#include<iostream>#include <string>#include<math.h>#include <sstream>using namespace std;string do_fraction(long double value, int digits){ long double val1 = value;...原创 2018-09-10 19:51:48 · 2978 阅读 · 0 评论 -
随机数动态数组排序计时输出
#include#include#includeusing namespace std;void mp(int *p, int n){int len = n;for (int i = 1; ifor (int j = 0; j{if (p[j]{p[j] = p[j] ^ p[j + 1];p[j + 1] = p[j + 1]原创 2016-11-03 14:31:26 · 378 阅读 · 0 评论 -
利用按位异或运算符实现矩阵转置
#includeusing namespace std; int main() { int a[][4]={{3,6,1,9},{3,8,3,6},{7,2,1,5},{4,3,0,9}}; int i,j; for(i=0;i { for(j=i+1;j { a[i][j]=a[i][j]^a[j][i]; //只限整型原创 2016-11-03 14:34:38 · 1471 阅读 · 1 评论 -
蓝桥杯三个整数排
#includeusing namespace std;int max(int &a, int &b){ if (a < b) { int t = a; a = b; b = t; } return a;}int min(int &b, int &c){ if (c > b) { int t = c; c = b原创 2016-11-03 14:42:13 · 349 阅读 · 0 评论 -
蓝桥杯马虎等式
#include#includeusing namespace std;int main(){ int a, b, c, d, e, i = 0; clock_t start=clock(); for (a = 1; a < 10; a++) for (b = 1; b < 10; b++) for (c = 1; c < 10; c++)原创 2016-11-03 14:48:53 · 281 阅读 · 0 评论 -
C++中含虚函数类继承与实现
#includeusing namespace std;class Base1{public: virtual void A() { }};class Base2{public: virtual void B() { }};class Zilei1 :public原创 2016-11-03 14:56:06 · 383 阅读 · 0 评论 -
学校蓝桥杯选拔题分鱼
#includeusing namespace std;int main(){ int i,j,n; for(i=6;;i++) { int f[5]={0}; n=i; for(j=0;j<5;j++) { if(n%5==1) f[j]=1; else //原创 2016-11-03 15:31:52 · 895 阅读 · 0 评论 -
智能指针
#include#include#include#include using namespace std;int i(0);void autopoint(){ while(i<5) { Sleep(1000); double *p=new double[1024*1024*600]; auto_ptr autop(p);转载 2016-11-03 15:35:26 · 258 阅读 · 0 评论 -
多线程案例
#include#include#include#includeusing namespace std;void ms(){ MessageBoxA(0, "wanghuankong", "1", 1);}void main(){ /*thread ths[4]{thread(ms), thread(ms), thread(ms), th原创 2016-11-03 15:39:21 · 238 阅读 · 0 评论 -
北大OJ编程基础之循环控制数字反转
#include#includeusing namespace std;int main(){ char *str=NULL,t; int i; *str=cin.gets(); int L = strlen(str); for (i = 0; i < L / 2; i++) { cout << str[i]; } cout <<原创 2016-11-03 15:46:15 · 454 阅读 · 0 评论 -
蓝桥杯高斯日记
#includeusing namespace std;class Date{ int y,m,d; public: Date(int year,int month,int day):y(year),m(month),d(day){} void rn(); void pn(); void Print() { if原创 2016-11-03 16:04:18 · 404 阅读 · 0 评论 -
一年之中第几天
#includeusing namespace std;class Date{ int y,m,d,n; public: void rn(); void pn(); void Input() { cin>>y>>m>>d; } void Print() { cout<<n-1; } void c原创 2016-11-03 16:07:21 · 355 阅读 · 0 评论 -
n皇后.cpp
#include #include const int N=20; //最多放皇后的个数 int q[N]; //各皇后所在的行号 int cont = 0; //统计解得个数 //输出一个解 void print(int n) { int i,j; cont++; prin原创 2016-11-03 16:14:41 · 299 阅读 · 0 评论 -
新国王释放犯人
#include#includeusing namespace std;int main(){ int N,i,j; cin>>N; int *p=new int[N]; for(i=0;i<N;i++) p[i]=0; for(i=0;i<N;i++) { if(i==0) continue;原创 2016-11-03 16:22:12 · 575 阅读 · 0 评论 -
南阳理工学院在线评测系统-兄弟郊游问题
兄弟郊游问题时间限制:3000 ms | 内存限制:65535 KB难度:2描述兄弟俩骑车郊游,弟弟先出发,每分钟X米,M分钟后,哥哥带一条狗出发。以每分钟Y米的速度去追弟弟,而狗则以每分钟Z米的速度向弟弟跑去,追上弟弟后又立即返回,直到哥哥追上弟弟时,狗跑了多少米?输入第一行输入一个整数N,表示测试数据的组数(N每组测试数据占一行,是四个正整数,分别为M,X,Y,原创 2016-11-04 12:56:26 · 1022 阅读 · 0 评论 -
南阳理工学院-n-1位数
n-1位数时间限制:3000 ms | 内存限制:65535 KB难度:1描述已知w是一个大于10但不大于1000000的无符号整数,若w是n(n≥2)位的整数,则求出w的后n-1位的数。输入第一行为M,表示测试数据组数。接下来M行,每行包含一个测试数据。输出输出M行,每行为对应行的n-1位数(忽略前缀0)。如果除了最高位外,其余位都为0,则输出0。原创 2016-11-04 15:35:48 · 518 阅读 · 0 评论 -
蓝桥杯2015年校内选拔题-让我怎能过大年
有如下的加法算式。其中每个汉字代表一个数字。(如果存在对齐问题,可参见【图1.png】) 年 大年 过大年 能过大年 怎能过大年 我怎能过大年+ 让我怎能过大年------------------ 能能能能能能能请填写“让我怎原创 2016-11-16 19:29:49 · 1038 阅读 · 0 评论 -
汉诺塔
#include using namespace std; void f(intn, char A, char B,char C){ if (1 == n) { cout A "-->" C endl; } else { f(n - 1, A, C, B);原创 2016-11-03 14:04:40 · 227 阅读 · 0 评论