Chinaunix首页 | 论坛 | 博客
  • 博客访问: 838172
  • 博文数量: 158
  • 博客积分: 4380
  • 博客等级: 上校
  • 技术积分: 2367
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-21 10:45
文章分类

全部博文(158)

文章存档

2012年(158)

我的朋友

分类: C/C++

2012-11-23 15:27:25

专门保存代码片断

阅读(8958) | 评论(66) | 转发(0) |
给主人留下些什么吧!~~

网友评论2012-11-23 15:35:23

周星星
HFONT hFont = (HFONT)::SendMessage( m_hName, WM_GETFONT, 0, 0 );
if(hFont==0) hFont=(HFONT)::GetStockObject(SYSTEM_FONT);
LOGFONT dtLogFont;
::GetObject( hFont, sizeof(dtLogFont), &dtLogFont );
dtLogFont.lfWeight = FW_BOLD;
hFont = ::CreateFontIndirect(&dtLogFont);
::SendMessage( m_hName, WM_SETFONT, (WPARAM)hFont, MAKELONG(TRUE,0) );

网友评论2012-11-23 15:35:14

周星星
template<typename Target, typename Source>
Target lexical_cast(Source arg) {
    std::stringstream interpreter;
    Target result;
    if( !(interpreter<<arg) || !(interpreter>>result) || !(interpreter>>std::ws).eof() )
        throw bad_lexical_cast();
    return result;
}

网友评论2012-11-23 15:35:04

周星星
#include <iostream>
using namespace std;

// 杨辉三角
// 1
// 1 1
// 1 2 1
// 1 3 3 1
// 1 4 6 4 1
// 1 5 10 10 5 1
// 1 6 15 20 15 6 1
// 1 7 21 35 35 21 7 1
// 1 8 28 56 70 56 28 8 1
// 1 9 36 84 126 126 84 36 9 1
int main()
{
    const size_t N = 10; // 行数

    unsigned line[N] = { 1 };
    for( size_t i=0; i<N; ++i

网友评论2012-11-23 15:34:55

周星星
CMOVA/CMOVNBE 高于(CF=0 and ZF=0)
CMOVAE/CMOVNB 高于等于(CF=0)          == CMOVNC 无进位(CF=0)
CMOVB/CMOVNAE 低于(CF=1)              == CMOVC  有进位(CF=1)
CMOVBE/CMOVNA 低于等于(CF=1 or ZF=1)

CMOVG/CMOVNLE 大于(ZF=0 and SF=OF)
CMOVGE/CMOVNL 大于等于(SF=OF)
CMOVL/CMOVNGE 小于(SF<>OF)
CMOVLE/CMOVNG 小于等于(ZF=1 or SF<>OF)

CMOVE  等于(

网友评论2012-11-23 15:34:46

周星星
#include <cstddef>
bool init( size_t num, size_t pow, size_t loop[] )
{
    if( num > pow ) return false;

    for( size_t i=0; i<num; ++i )
        loop = i;
    return true;
}
bool next( size_t num, size_t pow, size_t loop[] )
{
    size_t index = num;
    for( ; index!=0; --index )
    {<