上一页 1 2 3 4 5 6 7 8 ··· 12 下一页
摘要: C++ mechanisms for polymorphismExplicit programmer-specified polymorphismYou can writef()such that it can operate on multiple types in any of the following ways:Preprocessing:#define f(X)((X)+=2)// (note: in real code, use a longer uppercase name for a macro!)Overloading:void f(int& x){ x +=2;}v 阅读全文
posted @ 2013-04-04 20:10 strorehouse 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 网上某些流传的答案是错误的,以讹传讹,呵呵In c++ 03:default ctorcopy ctorassignment operatordefault destructorIn c++ 0x:default ctorcopy ctorassignment operatordefault destructormove constructormove-assignment operator 阅读全文
posted @ 2013-04-02 20:15 strorehouse 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 此处下载:Feature:* Initialiser lists and lambdas no longer cause curly error highlighting ({} allowed within parentheses).* constexpr keyword added.安装:1 tar -xvzf cpp11.tgz -C ~/.vim/syntax2 echo "au BufNewFile,BufRead *.cpp set syntax=cpp11" >> ~/.vimrc 阅读全文
posted @ 2013-04-02 10:51 strorehouse 阅读(154) 评论(0) 推荐(0) 编辑
摘要: View Code /*refer:http://stackoverflow.com/questions/270947/can-any-one-provide-me-a-sample-of-singleton-in-c/271104#271104 */#include <vector>#include <string>#include <iostream>using namespace std;class Sin{ public: static Sin& getInstance() { static Sin instance; ... 阅读全文
posted @ 2013-04-01 21:21 strorehouse 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 去年就在某牛人的博客上见到了,现在准备去玩玩。做题的方式跟Topcoder类似,刚刚去水了一题"Valid Palindrome" 1 class Solution { 2 public: 3 bool isPalindrome(string s) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 string alnumstr; 7 transform(s.begin(), s.end(), s.... 阅读全文
posted @ 2013-03-08 18:26 strorehouse 阅读(936) 评论(0) 推荐(0) 编辑
摘要: 近日仍在学习Linux编程,可以算是多本书一起看。发现《Beginning Linux Programming》4th书中一处比较严重的错误,比较容易误导C语言初学者。 代码取自Chapter 15:Sockets,英文版625页,片段如下: 1 int main (int argc, char* argv[]) 2 { 3 char *host, 4 **names, 5 **addrs; 6 struct hostent* hostinfo; 7 8 if (argc == 1) 9 {10 ... 阅读全文
posted @ 2013-01-15 09:46 strorehouse 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 一张名单表中存有本院考号和姓名,一张成绩表中存有全校学生的考号、分数、排名。使用了xlrd package,挺好用的。 1 import xlrd 2 3 nameBook = xlrd.open_workbook("/home/chm/Documents/namesheet.xls") 4 markBook = xlrd.open_workbook("/home/chm/Documents/mark.xls") 5 6 nameSheet = nameBook.sheet_by_index(0) 7 markSheet = markBook.sheet 阅读全文
posted @ 2012-12-17 08:55 strorehouse 阅读(484) 评论(0) 推荐(0) 编辑
摘要: 1. 编写代码:在上次的文件夹中新建BasicTutorial2.h和BasicTutorial2.cpp文件:BasicTutorial2.h: 1 #ifndef BASICTUTORIAL2_H 2 #define BASICTUTORIAL2_H 3 4 #include "BaseApplication.h" 5 6 class BasicTutorial2:public BaseApplication 7 { 8 public: 9 BasicTutorial2(void);10 virtual ~BasicTutorial2(void);11 12 prote 阅读全文
posted @ 2012-12-05 21:00 strorehouse 阅读(342) 评论(0) 推荐(0) 编辑
摘要: 1. 下载源代码及脚本这里有一个‘Convenient All-In-One’ 版的框架。2. 创建场景解压clean_ogre_cmake_project.zip,修改TutorialApplication.cpp中的函数: 1 void TutorialApplication::createScene(void) 2 { 3 // create your scene here :) 4 mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5f,0.5f,0.5f)); 5 6 // Create an entity 7 ... 阅读全文
posted @ 2012-12-03 18:12 strorehouse 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 1 .下载源代码我下载的是ogre_src_v1-7-42. 安装编译工具及依赖包编译及配置工具sudo apt-get install build-essential automake libtool -qq -y关系依赖sudo apt-get install libfreetype6-dev libfreeimage-dev libzzip-dev libxrandr-dev libxaw7-dev freeglut3-dev libgl1-mesa-dev libglu1-mesa-dev -qq -y非必需的依赖(顺便安装下)sudo apt-get install nvidia-c 阅读全文
posted @ 2012-12-03 11:14 strorehouse 阅读(585) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 12 下一页