欢迎访问我的独立博客

11 2012 档案

摘要:一,输出九九表#include <stdio.h>//用到printf输出函数int main(){ for(int i=1;i<=9;i++)//i为行数,共9行 { for(int j=1;j<=i;j++)//j为当前行应该输出的式子个数,第2行会输出2个式子,第3行会输出3个式子,即式子个数j小于等于当前行号i { printf("%d*%d=%d\t",j,i,j*i);//"\t"相当于按Tab键,用于输出多个空格 } printf("\n");//输出换行 } ... 阅读全文
posted @ 2012-11-29 21:39 github.com/starRTC 阅读(245) 评论(0) 推荐(0) 编辑
摘要:SYSMETS.H#define NUMLINES ((int) (sizeof sysmetrics / sizeof sysmetrics [0]))struct{ int iIndex ; TCHAR * szLabel ; TCHAR * szDesc ;} sysmetrics [] ={ SM_CXSCREEN, TEXT ("SM_CXSCREEN"), TEXT ("Screen width in pixels"), SM... 阅读全文
posted @ 2012-11-28 19:48 github.com/starRTC 阅读(305) 评论(0) 推荐(0) 编辑
摘要:类的组合:对象充当成员在创建对象时,也要对内嵌对象初始化组合类构造函数定义类名::类名(形参):内嵌对象1(形参),内嵌对象2(形参){ }Circle:: Circle(float r){radius=r;}等价于Circle:: Circle(float r):radius(r) {}//效率更高此时构造函数调用顺序:1、调用内嵌对象的构造函数,按定义中出现的次序2、自己的组合类的拷贝构造函数,要为内嵌对象的拷贝构造函数传递参数,若C类中包含B类的对象b,则C类的拷贝构造函数形式为C::C(C &c1):b(c1.b) {…}全局变量和加static声明的,都具有静态生存期类的静态 阅读全文
posted @ 2012-11-28 18:33 github.com/starRTC 阅读(290) 评论(0) 推荐(0) 编辑
摘要://需要添加winmm.lib#include <windows.h> LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;//LRESULT等价于Longint WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow){ static TCHAR szAppName[] = TEXT ("HelloWin") ; HWND hwnd ; ... 阅读全文
posted @ 2012-11-28 14:38 github.com/starRTC 阅读(171) 评论(0) 推荐(0) 编辑
摘要:#include <windows.h>#include <tchar.h> #include <stdio.h> int CDECL MessageBoxPrintf (TCHAR * szCaption, TCHAR * szFormat, ...){ TCHAR szBuffer [1024] ; va_list pArgList ; // The va_start macro (defined in STDARG.H) is usually equivalent to: // pArgList = (char *... 阅读全文
posted @ 2012-11-28 13:21 github.com/starRTC 阅读(199) 评论(0) 推荐(0) 编辑
摘要:#include <windows.h>int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow){ MessageBox (NULL, TEXT ("Hello, World!"), TEXT ("HelloMsg"), 0) ;//0为OK return 0 ;} 阅读全文
posted @ 2012-11-28 09:56 github.com/starRTC 阅读(178) 评论(0) 推荐(0) 编辑
摘要:C/C++都区分大小写注释不会增加程序的大小符号常量可提高程序的可读性 const float PI=3.1415926;当“/”用于两个整型数据相除时,结果只取商的整数部分,如:1/2=0赋值运算符:自右而左 如a=b=c=5逗号表达式“表达式1,表达式2”//先求1,再求2,结果为表达式2的值条件表达式 表达式1?表达式2:表达式3//2和3可以是任何类型,且类型可以不同,结果为二者中较高的类型;先求1,若为真(非0),则求2,若为假,则求3;多个嵌套时,自右而左cout<<(score>=60?”pass”:”fail”);强制类型转换:c中为(int)a;而C++中为 阅读全文
posted @ 2012-11-22 23:22 github.com/starRTC 阅读(284) 评论(0) 推荐(0) 编辑
摘要:编译时要加上-g,才能用gdb调试list(l)列出源代码:list 1 //从第一行开始列出源代码start开始,next(n)一条条执行step(s)进入函数在函数中:bt查看堆栈 查看局部变量的值i locals显示变量的值 print(p) 如p sumfinish执行完当前函数修改sum变量的值set var sum = 0退出quit 阅读全文
posted @ 2012-11-22 12:31 github.com/starRTC 阅读(207) 评论(0) 推荐(0) 编辑
摘要:#include <boost/lexical_cast.hpp>#include <iostream>using namespace boost;using namespace std;int main(){ int x = lexical_cast<int>("100"); long y = lexical_cast<long>("2000"); float pi = lexical_cast<float>("3.14159e5"); double e = lexical 阅读全文
posted @ 2012-11-21 18:37 github.com/starRTC 阅读(336) 评论(0) 推荐(0) 编辑
摘要:#include <boost/utility.hpp>class no_copy : boost::noncopyable //默认私有继承{}; 阅读全文
posted @ 2012-11-21 18:28 github.com/starRTC 阅读(279) 评论(0) 推荐(0) 编辑
摘要:BETWEEN在 WHERE 子句中使用,用来选取两个值之间的数据。这些值可以是数值、文本或者日期。语法SELECT 列FROM 表WHERE 列BETWEEN value1 AND value2表:IdLastNameFirstNameAddressCity1AdamsJohnOxford StreetLondon2BushGeorgeFifth AvenueNew York3CarterThomasChangan StreetBeijing4GatesBillXuanwumen 10Beijing例现在需要以字母顺序显示介于 "Adams"(包括)和 "Car 阅读全文
posted @ 2012-11-15 18:54 github.com/starRTC 阅读(275) 评论(0) 推荐(0) 编辑
摘要:用vi新建一个文件:vi test.c状态栏中的18C表示有18个字符按i进入编辑模式,按ESC回到默认模式按下:后再输入wq存盘退出;强制写入:wq!一般模式下:(注意大小写)方向键移动光标;翻页Page Down/UPHome:一行最前; End一行最后G:移到最后一行, 20G移到第20行(可先设立行号),向右移动40个字符:40→gg:移到第一行;n<Enter>:光标向下移动n行搜索:/word 从光标处向下搜索,n向下继续搜索下一个?word 从光标处向上搜索,N向上继续搜索下一个:1,$s/word1/word2/g 将word1替换为word2,在g后面加c表示弹出 阅读全文
posted @ 2012-11-13 11:02 github.com/starRTC 阅读(276) 评论(0) 推荐(0) 编辑
摘要:第一题:输入实数x,按下列公式计算并输出x和y的值(保留两位小数)答案:#include <math.h>#include <stdio.h>int main(){ float x, y; scanf("%f", &x); if (x <= 0) { y = sin(x); } else if (x <= 10) { y = x*x + 1; } else { y= 1.0/(x*x*x + x*x + 1); } printf("x = %.2f,y = %.2f\n", x... 阅读全文
posted @ 2012-11-12 22:40 github.com/starRTC 阅读(748) 评论(0) 推荐(0) 编辑
摘要:加载中... 阅读全文
posted @ 2012-11-12 22:36 github.com/starRTC 阅读(141) 评论(0) 推荐(0) 编辑
摘要:用于在 WHERE 子句中规定多个值。语法SELECT 列 FROM 表 WHERE 列 IN (value1,value2,...)表:IdLastNameFirstNameAddressCity1AdamsJohnOxford StreetLondon2BushGeorgeFifth AvenueNew York3CarterThomasChangan StreetBeijing例如果我们希望从表中选取姓氏为 Adams 和 Carter 的人:SELECT * FROM PersonsWHERE LastName IN ('Adams','Carter') 阅读全文
posted @ 2012-11-11 12:59 github.com/starRTC 阅读(219) 评论(0) 推荐(0) 编辑
摘要:注:并非所有的数据库系统都支持 TOP 子句。Persons 表:IdLastNameFirstNameAddressCity1AdamsJohnOxford StreetLondon2BushGeorgeFifth AvenueNew York3CarterThomasChangan StreetBeijing4ObamaBarackPennsylvania AvenueWashingtonSQL Server 语法:SELECT TOP number|percent 列 FROM 表例:如果我们希望从上面的表中选取头两条记录。语句如下:SELECT TOP 2 * FROM Persons 阅读全文
posted @ 2012-11-10 09:51 github.com/starRTC 阅读(319) 评论(0) 推荐(0) 编辑
摘要:压缩技术:比如存1时,共8bit,最右边为1,其它7位为0,压缩时将0压缩。或者将重复数据压缩。常用命令:compress(淘汰)gzip(常用) 与 zcatbzip2(常用) 与bzcat打包命令tar压缩文件的扩展名大多是*.tar *.tar.gz *.tgz *.gz *.Z *.bz2其中*.Z是compress压缩的;*.gz是gzip压缩的;*.bz2是bzip2压缩的;*.tar是tar程序打包但没有压缩的;.tar.gz是打包后并经gzip压缩的;.tar.bz2是打包后并经bzip2压缩的;通常,压缩与解压缩只针对一个文件;从而打包指令就派上用场了。gzip与zcatgz 阅读全文
posted @ 2012-11-09 19:06 github.com/starRTC 阅读(296) 评论(0) 推荐(0) 编辑
摘要:先su切换进超级账户#hostname //查看机器名#hostname -i //查看本机器名对应的ip地址1 # vi /etc/sysconfig/networkNETWORKING=yesHOSTNAME=yourname (在这修改hostname,把yourname换成想用的名字)2.修改/etc/hosts里面的名字# vi /etc/hosts127.0.0.1 localhost.localdomain localhost (在这修改hostname,把末尾的localhost换成想用的名字)3.最后在终端下执行:# hostname ***** (*****为修改后的hos 阅读全文
posted @ 2012-11-09 18:46 github.com/starRTC 阅读(232) 评论(0) 推荐(0) 编辑
摘要:打开最顶层文件夹的时候用右键,选择里面的“浏览文件夹”里面的子文件夹再打开的时候都不会在新窗口中打开了。 阅读全文
posted @ 2012-11-09 12:59 github.com/starRTC 阅读(221) 评论(0) 推荐(0) 编辑
摘要:打开Xcode,选择Command Line Tool,类型选择Foundation;其中.m为源文件;例1:#import <Foundation/Foundation.h>int main(int argc, const char * argv[]){ NSLog(@"Hello, World!"); return 0;}例2:BOOL与NSString的使用#import <Foundation/Foundation.h>BOOL isDiff(int a, int b){ if(a==b) { return (NO); } else ... 阅读全文
posted @ 2012-11-09 01:44 github.com/starRTC 阅读(304) 评论(0) 推荐(0) 编辑
摘要:编辑:Ctrl+E到行尾Ctrl+A到行首调试:添加断点: 在对应代码行的左边栏目,点左键去掉断点:选中断点 ->按着 Ctrl 点左键–>在弹出的菜单中选择“删除断点”打断点之后,点击Run按钮,会运行到断点处,然后点击界面下方的Step Over按钮就可以单步跟踪了。Step into是进入,step out是跳出,continue program execution是执行到下一个断点处。在窗口右上角“View”栏中点击“Hide or show the Debug area”可以打开调试窗口(包含输出窗口) 阅读全文
posted @ 2012-11-09 01:32 github.com/starRTC 阅读(358) 评论(0) 推荐(0) 编辑
摘要:最有价值的!最有用的引用计数型智能指针,可以被拷贝和赋值,可以作为STL容器的元素;1,基本用法:#include <boost/smart_ptr.hpp>#include <assert.h>using namespace boost;int main(){ shared_ptr<int> sp(new int(10)); assert(sp.unique()); shared_ptr<int> sp2 = sp; assert(sp == sp2 && sp.use_count() == 2); *sp2 = 100; as 阅读全文
posted @ 2012-11-08 17:03 github.com/starRTC 阅读(321) 评论(0) 推荐(0) 编辑
摘要:1,libc(Linux下的ANSI C的函数库)char * strcat(char * dest, const char * src){ char *tmp = dest; while (*dest) dest++; while ((*dest++ = *src++) != '\0') ; return tmp;}2,微软char* strcat ( char * dst , const char * src ){char * cp = dst;while( *cp )cp+... 阅读全文
posted @ 2012-11-08 08:23 github.com/starRTC 阅读(5187) 评论(3) 推荐(1) 编辑
摘要:WAMP是Windows下的Apache+Mysql+Perl/PHP/Python;1, 下载wampserver并安装;安装前请先安装VC 2010运行库,否则会提示没有找到MSVCR100.dll而导致安装失败;2, 打开wampserver,在托盘处右击启动所有服务。(如果有IIS,打开IIS,删除默认网站);安装wordpress1, 下载wordpress;2, 设置wamp:apache—-apache模块—-勾上rewrite_module,这个很重要,如果你没有修改这一项,你就不能在wordpress中设置永久链接。3, 添加数据库。运行phpMyAdmin,创建数据库:在右 阅读全文
posted @ 2012-11-06 23:00 github.com/starRTC 阅读(972) 评论(0) 推荐(0) 编辑
摘要:fill对区间填充原型:template < class ForwardIterator, class T >void fill ( ForwardIterator first, ForwardIterator last, const T& value ){ while (first != last) *first++ = value;}填充区间[first,last)示例:#include <iostream>#include <algorithm>#include <vector>using namespace std;int mai 阅读全文
posted @ 2012-11-06 19:50 github.com/starRTC 阅读(806) 评论(0) 推荐(0) 编辑
摘要:float 型只能保证 6 位有效数字(后面的数字不准确), double 型至少可以保证 10 位有效数字,能满足大多数计算的需要。%运算两侧均为整型数据vc中int占4B\b:移到前一列 \r移到本行开头 \’输出单引号两整数相除结果为整数,如5/3=1 -5/3=-1而不是-2(取整后向0靠拢)int i=3.56//结果i=3(舍弃小数部分)double赋给float时,截取前7位有效数字,反之,扩展到16位putchar输出字符puts输出字符串char c=getchar();printf(“%c”,getchar());%10.2f(共10列,2位小数) %.2f相当于%2.2f 阅读全文
posted @ 2012-11-06 19:35 github.com/starRTC 阅读(247) 评论(0) 推荐(0) 编辑
摘要:用于删除表中的行。语法DELETE FROM 表 WHERE 列 = 值Person:LastNameFirstNameAddressCityGatesBillXuanwumen 10BeijingWilsonFredZhongshan 23Nanjing删除某行删除"Fred Wilson" :DELETE FROM Person WHERE LastName = 'Wilson'结果:LastNameFirstNameAddressCityGatesBillXuanwumen 10Beijing删除所有行DELETE FROM 表 阅读全文
posted @ 2012-11-06 19:10 github.com/starRTC 阅读(238) 评论(0) 推荐(0) 编辑
摘要:语法:UPDATE 表 SET 列 = 新值 WHERE 列名 = 某值Person:LastNameFirstNameAddressCityGatesBillXuanwumen 10BeijingWilsonChamps-Elysees例:更新某一行中的一个列我们为Lastname 是 "Wilson" 的人添加 firstname:UPDATE Person SET FirstName = 'Fred' WHERE LastName = 'Wilson'结果:LastNameFirstNameAddressCityGatesBillXua 阅读全文
posted @ 2012-11-06 18:54 github.com/starRTC 阅读(351) 评论(0) 推荐(0) 编辑
摘要:语法INSERT INTO 表 VALUES (值1, 值2,....)也可以指定要插入数据的列:INSERT INTO表(列1, 列2,...) VALUES (值1, 值2,....)例:插入新的行"Persons" 表:LastNameFirstNameAddressCityCarterThomasChangan StreetBeijingSQL 语句:INSERT INTO Persons VALUES ('Gates', 'Bill', 'Xuanwumen 10', 'Beijing')结果:Las 阅读全文
posted @ 2012-11-06 18:47 github.com/starRTC 阅读(250) 评论(0) 推荐(0) 编辑
摘要:默认为升序,如果希望按降序对记录进行排序,可使用 DESC 关键字。Orders 表:CompanyOrderNumberIBM3532W3School2356Apple4698W3School6953例 1以字母顺序显示公司名称:SELECT Company, OrderNumber FROM Orders ORDER BY Company结果:CompanyOrderNumberApple4698IBM3532W3School6953W3School2356例 2以字母顺序显示公司名称(Company),并以数字顺序显示OrderNumber:SELECT Company, OrderNu 阅读全文
posted @ 2012-11-06 18:38 github.com/starRTC 阅读(319) 评论(0) 推荐(0) 编辑
摘要:AND 和 OR 可在 WHERE 子句中把两个或多个条件结合起来。表:LastNameFirstNameAddressCityAdamsJohnOxford StreetLondonBushGeorgeFifth AvenueNew YorkCarterThomasChangan StreetBeijingCarterWilliamXuanwumen 10BeijingAND实例使用 AND 来显示所有 姓为 "Carter" 并且名为 "Thomas" 的人:SELECT * FROM Persons WHERE FirstName='Tho 阅读全文
posted @ 2012-11-06 10:53 github.com/starRTC 阅读(393) 评论(0) 推荐(0) 编辑
摘要:智能指针,stl中有auto_ptr,boost的smart_ptr库有6种:scoped_ptr,scoped_array,shared_ptr,shared_array,weak_ptr和intrusive_ptr.scoped_ptr的拷贝构造函数和赋值操作符声明为私有,以禁止对智能指针的复制。例1:#include <boost/smart_ptr.hpp>#include <iostream>#include <string>using namespace std;using namespace boost;int main(){ scoped_p 阅读全文
posted @ 2012-11-06 08:43 github.com/starRTC 阅读(243) 评论(0) 推荐(0) 编辑
摘要:timer库(含timer,progress_timer和progress_display三个组件)和date_timetimer用法:#include <boost/timer.hpp>#include <iostream>using namespace std;using namespace boost;int main(){ timer t;//开始计时 cout<<"max timespan:"<<t.elapsed_max()/3600<<"h"<<endl; cout&l 阅读全文
posted @ 2012-11-06 08:37 github.com/starRTC 阅读(183) 评论(0) 推荐(0) 编辑
摘要:STLPort是C++标准库的一个高效实现具有高度的可移植性,最新版本是5.21版,先下载“STLport-5.2.1.tar.bz2”,解压到D:\develop\STLport-5.2.1使用时要先编译:1,从开始菜单运行vs2005的命令行提示工具“Visual Studio 2005 Command Prompt”;2,cd进入D:\develop\STLport-5.2.1目录;3,执行”configure msvc8”(vc6使用msvc6,vc9即vs2008使用msvc9)4,执行”cd D:\develop\STLport-5.2.1\build\lib”5,执行”nmake 阅读全文
posted @ 2012-11-06 08:31 github.com/starRTC 阅读(914) 评论(0) 推荐(0) 编辑
摘要:1,微软实现C:\Program Files\Microsoft Visual Studio 10.0\VC\crt\src\strcat.cchar * strcpy(char * dst, const char * src){ char * cp = dst; while( *cp++ = *src++ ) ; /* Copy src over dst */ return( dst );}2,林锐《高质量C++/C编程指南》#include <assert.h>char *strcpy(ch... 阅读全文
posted @ 2012-11-05 21:29 github.com/starRTC 阅读(1900) 评论(0) 推荐(0) 编辑
摘要:通配符可以替代一个或多个字符。通配符必须与 LIKE 运算符一起使用。在 SQL 中,可使用以下通配符:通配符描述%替代一个或多个字符_仅替代一个字符[charlist]字符列中的任何单一字符[^charlist]或者[!charlist]不在字符列中的任何单一字符Persons 表:IdLastNameFirstNameAddressCity1AdamsJohnOxford StreetLondon2BushGeorgeFifth AvenueNew York3CarterThomasChangan StreetBeijing使用 % 通配符例 1如果我们希望从上面的表中选取居住在以 &qu 阅读全文
posted @ 2012-11-05 21:01 github.com/starRTC 阅读(347) 评论(0) 推荐(0) 编辑
摘要:如果需要有条件地从表中选取数据,可将 WHERE 子句添加到 SELECT 语句中。语法SELECT 列 FROM 表 WHERE 列 运算符 值下面的运算符可在 WHERE 子句中使用:操作符描述=等于<>不等于>大于<小于>=大于等于<=小于等于BETWEEN在某个范围内注:在某些数据库系统中,操作符 <> 也可以写为 !="Persons" 表LastNameFirstNameAddressCityYearAdamsJohnOxford StreetLondon1970BushGeorgeFifth AvenueNew 阅读全文
posted @ 2012-11-05 20:53 github.com/starRTC 阅读(349) 评论(0) 推荐(0) 编辑
摘要:一,用vc6新建一个“win32 dynamic-link library”工程,(在vs2008中工程类型选Win32控制台应用程序)二,添加DLLTest.h文件#ifdef DLL_API#else#define DLL_API extern "C" _declspec(dllimport)#endifDLL_API int add(int a, int b);DLL_API int sub(int a, int b);三,添加.cpp文件#define DLL_API extern "C" _declspec(dllexport)#include 阅读全文
posted @ 2012-11-05 01:56 github.com/starRTC 阅读(227) 评论(0) 推荐(0) 编辑
摘要:在表中,某些列有时可能会包含重复值。而您仅仅希望列出不同(distinct)的值。关键词 DISTINCT 用于返回不同的值。语法:SELECT DISTINCT 列名 FROM 表名"Orders"表:CompanyOrderNumberIBM3532W3School2356Apple4698W3School6953如果要从 "Company" 列中选取所有的值,可使用如下语句:SELECT Company FROM Orders结果:CompanyIBMW3SchoolAppleW3School请注意,在结果集中,W3School 被列出了两次。若需 阅读全文
posted @ 2012-11-05 01:43 github.com/starRTC 阅读(340) 评论(0) 推荐(0) 编辑
摘要:SQL 对大小写不敏感!CREATE DATABASE - 创建新数据库ALTER DATABASE - 修改数据库CREATE TABLE - 创建新表ALTER TABLE - 变更数据库表DROP TABLE - 删除表CREATE INDEX - 创建索引DROP INDEX - 删除索引 阅读全文
posted @ 2012-11-05 01:36 github.com/starRTC 阅读(195) 评论(0) 推荐(0) 编辑
摘要:压缩包里含有:主程序+汉化包+注册机下载地址:http://bfile.xp510.com:801/bigfile/VMware-workstation_xp510.com.zip以下序列号来源于网络,仅供测试使用:JV695-DR0D3-LZUC0-H8852-CAWJ44F297-84H0M-MZN18-X207P-ACQLQNZ0Z1-F815K-UZ999-GU9QP-8ALMZ5F4A9-46H97-2Z4A8-U0272-C352D0C44H-DP0E6-6Z6U8-F81ZK-9C8NM4A4XJ-D0296-2ZWT9-TK0N6-8CN07 阅读全文
posted @ 2012-11-04 16:12 github.com/starRTC 阅读(507) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示