随笔分类 -  00.C/C++

摘要:发现将编译改成UTF-8后,程序输出乱码;查看dos cmd的 Active Code Page 发现为 936dos命令改为UTF-8: chcp 65001chcp查看,即为65001再增加gcc编译选项:-finput-charset=UTF-8直接启动还是乱码,因为cosole_runner.exe没有改变Acitve code page.而在windows的cmd下面运行,则无乱码现象.还是换回936吧,没那么麻烦,如果不考虑跨平台编译什么的. 阅读全文
posted @ 2011-11-26 01:16 庚武 阅读(513) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2011-10-24 18:42 庚武 阅读(1) 评论(0) 推荐(0)
摘要:from:http://www.haskell.org/haskellwiki/Haskell_in_5_steps#Write_your_first_parallel_Haskell_program起由: Write your first parallel Haskell programHaskell has good support for parallel and multicore programming. We can write a parallel program by adding `par` to expressions, like so:import Control.Par 阅读全文
posted @ 2011-10-20 15:10 庚武 阅读(2159) 评论(1) 推荐(0)
摘要:http://www.cs.rpi.edu/~hollingd/psics/notes/backtracking.pdfTwo situations:– Finding a solution to a problem can't be based on astraight path to the goal.● consider traversing a maze.– We need a better approach than brute force(independently evaluating all possible solutions).● Think of the TSP 阅读全文
posted @ 2011-10-13 19:51 庚武 阅读(1286) 评论(0) 推荐(0)
摘要:Note that only command events (whose event classes are based directly or indirectly on wxCommandEvent) are recursively applied to the window parent's event handler. As this quite often causes confusion for users,here is a list of system events that will not get sent to the parent's event han 阅读全文
posted @ 2011-10-06 19:00 庚武 阅读(350) 评论(0) 推荐(0)
摘要:Ultimate Packer for eXecutables Copyright (C) 1996 - 2010UPX 3.07w Markus Oberhumer, Laszlo Molnar & John Reiser Sep 08th 2010Usage: upx [-123456789dlthVL] [-qvfk] [-o file] file..Commands: -1 compress faster -9 compre... 阅读全文
posted @ 2011-10-06 16:00 庚武 阅读(566) 评论(0) 推荐(0)
摘要:windows下,注意文件格式设为UTF-8。Code::Blocks 10.05设置: Setting -> EditorMain.cpp:#include "wx/wx.h"//Declare the application classclass MyApp:public wxApp{public: //Called on application startup virtual bool OnInit();};// Declare our main frameclassclass MyFrame:public wxFrame{public: // Construc 阅读全文
posted @ 2011-10-05 00:26 庚武 阅读(1097) 评论(0) 推荐(0)
摘要:复制构造函数copy constructor、赋值操作符 operator =、析构函数destructor:不管类是否定义了自己的析构函数,编译器都自动执行类中非static数据成员的析构函数。复制构造函数、赋值操作符、析构函数 总称为复制控制(copy control)。编译器自动实现这些操作,但类也可以定义自己的版本。下面代码所使用copy contructor的地方有:class Point{public: Point(){} Point(const Point & p){ static int i=0; cout<<++i<<"call Po 阅读全文
posted @ 2011-10-03 11:50 庚武 阅读(291) 评论(0) 推荐(0)
摘要:WxWindowsQuickRef快速引用:http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef#Frequently_Asked_Questions中文wxWidgets编译与简单测试http://hi.baidu.com/fcl06/blog/item/5233d8efbdaa763fadafd52f.html-------------------------------------------------------Execute the build command. The recommended command to 阅读全文
posted @ 2011-10-03 00:35 庚武 阅读(1058) 评论(0) 推荐(0)
摘要:map<char,int> first; first['a']=1; first['b']=2; first['c']=3; first['d']=4; first['e']=5; first['a']=11; //overrite 1 map<char,int>::iterator it; for(it=first.begin();it!=first.end();++it){ cout<<it->first<<"="< 阅读全文
posted @ 2011-10-02 21:22 庚武 阅读(276) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2011-10-02 03:05 庚武 阅读(128) 评论(0) 推荐(0)
摘要:conio.h不是C标准库中的头文件。conio是Console Input/Output(控制台输入输出)的简写,其中定义了通过控制台进行数据输入和数据输出的函数,主要是一些用户通过按键盘产生的对应操作,比如getch()函数等等。包含的函数: cgets(char *); cprintf(const char *, ...); cputs(const char *); cscanf(const char *, ...); inp(unsigned short); inpw(unsigned short); getch(void); getche(void); kbhit(... 阅读全文
posted @ 2011-09-16 15:56 庚武 阅读(1009) 评论(0) 推荐(0)
摘要:#include <iostream>#include <bitset>#include <cstdio>#include <cstdlib>#include <ctime>#include <cmath>using namespace std;int main(){ const int len=10000000; //const int len=10000; cout<<"耗内存约:"<< len/8.0 //byte /1024.0 //kb /1024.0 //mb < 阅读全文
posted @ 2011-06-29 02:06 庚武 阅读(196) 评论(0) 推荐(0)
摘要:GCC stands for "GNU Compiler Collection", support C,C++,Objective-C,Objective-C++,Java,Fortran, and Ada.Languages Standards Supported by GCC1.C language: a.C89(or ocasionally as C90),To select this standard in GCC,use one of the options '-ansi','-std=c90',or '-std=iso98 阅读全文
posted @ 2011-06-27 22:35 庚武 阅读(577) 评论(0) 推荐(0)
摘要:#include <iostream>#include <iomanip>#include <cstdlib>using namespace std;void bubbleSort(int [],const int, bool(*)(int,int));void swap(int * const,int * const);bool ascending(int ,int);bool descending(int,int);void print_arr(int [],int);int main(){ int arr[]={3,42,1,100,689,2,24, 阅读全文
posted @ 2011-06-12 17:17 庚武 阅读(260) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2011-06-07 02:29 庚武 阅读(1) 评论(0) 推荐(0)
摘要:条款45: 弄清C++在幕后为你所写、所调用的函数一个空类什么时候不是空类? ---- 当C++编译器通过它的时候。如果你没有声明下列函数,体贴的编译器会声明它自己的版本。这些函数是:一个拷贝构造函数,一个赋值运算符,一个析构函数,一对取址运算符。另外,如果你没有声明任何构造函数,它也将为你声明一个缺省构造函数。所有这些函数都是公有的。换句话说,如果你这么写:class Empty{};和你这么写是一样的:class Empty {public: Empty(); // 缺省构造函数 Empty(const Empty& rhs); // 拷贝构造函数 ~Empty(); // 析构函 阅读全文
posted @ 2011-05-23 20:51 庚武 阅读(227) 评论(0) 推荐(0)
摘要:#include <iostream>#include <vector>#include <string>#include <exception>#include <stdexcept>#define TEST_THISusing namespace std;class Parent{public : virtual void say(){cout<<"parent"<<endl;}};class Son:public Parent{public : virtual void say(){c 阅读全文
posted @ 2011-05-23 17:48 庚武 阅读(255) 评论(0) 推荐(0)
摘要:// TestCppConstructor.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>using namespace std;class A{public : A(int i = 0) { m_i = i; cout << m_i << "A的构造函数" << endl; } ~A() { cout << m_i << "A的析构函数\n"; } void f() { cout < 阅读全文
posted @ 2011-05-22 21:48 庚武 阅读(324) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <stdlib.h>//在#define中,标准只定义了#和##两种操作。//#用来把参数转换成字符串,//##则用来连接两个前后两个参数,把它们变成一个字符串。#define parser(n) printf("token"#n"=%d\n",token##n)int main(){ int token9=10; parser(9); return 0;}//output://token9=10 阅读全文
posted @ 2011-03-03 09:42 庚武 阅读(272) 评论(0) 推荐(0)