`
/浮点数计PI(π):
long double Pild = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196;
//输出有效为: 3.141592653589793115997963468544185161590576171875
//有效位: 3.141592653589793
//等价
//PILD01=3.141592653589793;
long double Pi2ld = 3.1415926535897932;
`
上个“调试”界面图:
![](https://box.kancloud.cn/08681aa77a809e1443c1a636d44668cb_980x551.png)
上一个“日志”界面:
![](https://box.kancloud.cn/26260d366c37d33efa5dfeea22419c41_407x722.png)
```
#include "stdafx.h"
#include "Project1car181101.h"
#include<iostream>
#include<fstream>
using namespace std;
#define MAX_LOADSTRING 100
// 全局变量:
HINSTANCE hInst; // 当前实例
WCHAR szTitle[MAX_LOADSTRING]; // 标题栏文本
WCHAR szWindowClass[MAX_LOADSTRING]; // 主窗口类名
ofstream cou02t;
// 此代码模块中包含的函数的前向声明:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: 在此处放置代码。
//调用Console控制台
***AllocConsole();
#pragma warning(disable:4996)
_tfreopen(TEXT("CONOUT$"), TEXT("w"), stdout);
_tfreopen(TEXT("CONOUT$"), TEXT("w"), stderr);
_tfreopen(TEXT("CONIN$"), TEXT("r"), stdin);
#pragma warning(default:4996)
_tsetlocale(LC_ALL, TEXT("chs"));***
//输出到文档(日志)
cou02t.open("f://log181123car_cou02t181124a1.txt");
// 初始化全局字符串
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadStringW(hInstance, IDC_PROJECT1CAR181101, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
// 执行应用程序初始化:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_PROJECT1CAR181101));
MSG msg;
// 主消息循环:
while (GetMessage(&msg, nullptr, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
//
// 函数: MyRegisterClass()
//
// 目标: 注册窗口类。
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEXW wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_PROJECT1CAR181101));
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_PROJECT1CAR181101);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassExW(&wcex);
}
//
// 函数: InitInstance(HINSTANCE, int)
//
// 目标: 保存实例句柄并创建主窗口
//
// 注释:
//
// 在此函数中,我们在全局变量中保存实例句柄并
// 创建和显示主程序窗口。
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
hInst = hInstance; // 将实例句柄存储在全局变量中
HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
//
//
int setpixe02l(HDC hdc, int x1, int y1, COLORREF color1) {
int y2 = 400 - y1;
SetPixel(hdc, x1, y2, color1);//500-y1, color1);
cou02t << "[y2:" << y2 << "]";// << endl;
return 1;
}
//函数目标:处理图像(重绘)
int wm01paint01(HDC hdc) {
int x01 = 100;
int y01 = 50;
for (int i = 1; i < 99; ++i) {
int x02 = x01 + i;
SetPixel(hdc, x01+i, y01+i , RGB(200, 0, 0));//Red色
setpixe02l(hdc, x01+i , y01+i , RGB(0,200, 0));//green色
cou02t << "[x02:" << x02 << "]";// << endl;
}//for210i
cout << "[x01:" << x01 << endl;
return 1;
}
//
// 函数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// 目标: 处理主窗口的消息。
//
// WM_COMMAND - 处理应用程序菜单
// WM_PAINT - 绘制主窗口
// WM_DESTROY - 发送退出消息并返回
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_COMMAND:
{
int wmId = LOWORD(wParam);
// 分析菜单选择:
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
break;
case WM_PAINT:
{//case110
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
// TODO: 在此处添加使用 hdc 的任何绘图代码...
//
wm01paint01(hdc);
//
EndPaint(hWnd, &ps);
}//case110
break;
case WM_DESTROY:
```
KBJFW-NXHK6-W4WJM-CRMQB-G3CDH(请比尔家恕俺贫穷不义,等俺把娃养大定当回报Micro$oft和IT社会)
- vs2017宇宙最伟大IDE用Console等调试汇总
- c++Win32起始鼠标作图181101
- 用迭代法找(两圆的)交点-精确计算迭代并改进-数值周期1810
- 精度-比例关系181110P2点
- 用迭代法求找两圆交点-精度计算181111A
- 月亮型-大小圆-上下圆算法181121
- 用c++的数学计算及图形绘制总结之1/共4-181101
- 用c++做数学计算及图形绘制总结之2/4-181102
- 用c++做数学计算及图形绘制总结之3/4-181103
- 用c++做数学计算及图形绘制总结4/4-181104
- 用c++的移位代替乘除运算181105
- 重构billiard2圆相交-非递归181101-非预料内图形-原因分析181201
- 重构月亮型billiard202圆相交-非递归181102-非预料内图形-原因分析181202
- 重构月亮型billiard202圆相交-非递归181102b-非预料内图形-原因分析181202b
- 单椭圆(非递归)18圣诞后-ok版181225