#include <windows.h> #include <tchar.h>//_tWinMain _T() #include <stdio.h>//sprintf int WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd ) { //输出整数 TCHAR buffer[256]={0}; int x=-20,y=3,z=0; z=x*y; wsprintf(buffer,_T("%d*%d=%d"),x,y,z); MessageBox(NULL,buffer,_T("计算"),MB_OK|MB_TOPMOST); //输出浮点数 TCHAR szBuffer[256]={0}; float a=3.1415f; sprintf(szBuffer,_T("%.3f"),a); MessageBox(NULL,szBuffer,_T("计算"),MB_OK|MB_TOPMOST); return 0; }