公告版位
星落的瞬間!放棄的後悔是永遠!

目前分類:各種C++(CMD.EXE中) (43)

瀏覽方式: 標題列表 簡短摘要

http://sourceforge.net/p/stlport/code/ci/STLport-5.2/tree/

去抓最新版,有cmake
裡面的靜態記得要 _STLP_USE_DYNAMIC_LIB 的定義喔~
編完後~

如果想用 stlport 取代掉 目前預設的 stl 就取代就好
現在要講的是如何兩套 stl 並存
我會假設看的人都會設程式庫路徑跟標頭檔路徑

先定義這兩行別的 stlport 跟內建的 stl 衝突

讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

請參考:http://www.codeproject.com/Articles/16206/Call-C-code-from-C-and-read-an-array-of-struct-whi

我補個重點就好,
輸出那邊要勾 "註冊 COM Interop" 才會有tlb檔
*.tli 跟 *.tlh 都是不需要的
只有dll 可以用 http://msdn.microsoft.com/en-us/library/tzat5yw6.aspx
來產生 tlb 檔。


讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

比如說我編譯 jpeg 這個 library
在 msvc 裡
動態的
jpeg.lib & jpeg.dll
靜態的
libjpeg.lib

加上版本號的版本動態的
jpeg-9.lib & jpeg-9.dll
靜態的
libjpeg-9.lib

讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

獻給同是用C++做數值分析的研究生們!^^ 科科?

程式庫載點:http://ppt.cc/ENG9
程式載點:http://ppt.cc/ZVT-

從下面的結果可以看到一般 double 所不能做的運算,mpfr都能輕易做到。

計算

I(n) = 0積到1 {(x^n)/(x+10)} dx, n=0~30

讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

因為是近似的可能有誤差,我沒證明。
數學原理:
一.假設出上下兩面四邊形八個點
二.先把上下兩個面點的高平均
三.用海龍公式求出四邊形等於兩個三角形加起來
四.梯形公式上底加下底乘高把體積算出來

double TrangleArea(double a, double b, double c)
{
    double s = (a+b+c)*0.5;
    return sqrt(s*(s-a)*(s-b)*(s-c));

讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

參考:http://www.cnblogs.com/oomusou/archive/2009/05/09/c_split.html

wstrings split(const wchar_t *str, const wchar_t *del )
{
    int len = wcslen(str);
    std::vector<wchar_t> tstr;
    tstr.resize(len+1);
    wcscpy(&tstr[0], str);
    wstrings strs;
    wchar_t *s = wcstok(&tstr[0], del);
    while(s != NULL) {

讓地獄深紅的天亮 發表在 痞客邦 留言(1) 人氣()

#include <windows.h>
#include <mmsystem.h>
#pragma comment(lib,"winmm.lib")

void PlayBGM(std::wstring path)
{
    wchar_t buf[128];
    //use mciSendString()
    mciSendString((L"play "+ path).c_str(), buf, sizeof(buf),NULL);
    mciSendString((L"setaudio " + path + L" volume to 200").c_str(), buf,sizeof(buf),NULL);
}

讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

變數使用:

__device__ 變數就算看的到也吃不到,真是機車的關鍵字。
__global__ 函數要使用的值如果不是用參數方式傳入,就要是__constant__或是texture memory才行,
    也就是說__global__ 函數看的到__device__ 變數,但不能使用,一般cuda的__global__變數可以用參數的方式被使用。
重點就是__global__ 函數要傳很多參數進去...,不會變的參數最好用__constant__變數的方式傳入,可以省暫存器。

迴圈部份:
int idx = blockDim.x * blockIdx.x + threadIdx.x;
int inc = blockDim.x * gridDim.x;
for (int i = idx ; i < num ; i += inc)
{}

讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

http://dslweb.nwnexus.com/~ast/dload/guicon.htm

備份一下,很多網頁常常死。

#include <windows.h>
#include <iostream>
#include <fstream>

#include <stdio.h>
#include <fcntl.h>
#include <io.h>

void RedirectIOToConsole()
{

讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

std::string ss;
scanf("%s",&ss);
printf("%s",&ss);

isok on vc9 真是嚇死我了。


讓地獄深紅的天亮 發表在 痞客邦 留言(3) 人氣()

他說他從"深入學習c++"看的,可是我印象中沒有這本,但"深度學習c++"寫的還不錯,雖然沒有到很深,
至少比很多台灣作者最近出版的程式書好很多了,但是下面這個程式他說在"DEV-C++"上可以編譯成功!
編譯成功!
編譯成功!
編譯成功!
編譯成功!
編譯成功!
編譯成功!
編譯成功!
拜託不要嚇我好嗎?

讓地獄深紅的天亮 發表在 痞客邦 留言(2) 人氣()

http://damody.googlecode.com/files/tree_node.7z
就是非常簡單,想說用來放自己的壓縮檔的檔案庫管理。
最近對STL跟template愈來愈熟之後,回去寫VB.NET跟C#有種不順手的感覺qq
5/29修正RemoveAllByName的bug

TreeNode.hpp

#pragma once
#include <cstring>
#include <vector>
#include <string>
#include <ostream>

讓地獄深紅的天亮 發表在 痞客邦 留言(1) 人氣()

好吧,我也不知道我的方法對不對,啊對了,這次是在20分鐘內解決的xd。
使用高斯消去法。
輸入
0 2 4 6 8 0 2 4
2 3 4 7 6 1 -1 2
4 2 3 0 2 -2 2 4
6 -2 -3 0 2 -3 3 7
輸出
0 2 0 0 -7.28 3.6 -7.8 -8.92
2 0 0 0 0.8 -1 1 2.2

讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

此類別對fstream 只有一個重載:
friend fstream & operator << (fstream & f, const myclass& mc)
{
    //.....
    f << (double)(number); //這一行錯誤,isoc++認為有歧義,
//fstream & operator << (fstream & f, const myclass& mc) 跟
//內建吃double的operator << 衝到了,不知道要選哪個執行

    return f;
}

讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

http://www.ultimatepp.org/
今天才看到的,然後有template真的會編的比較慢加比較大跟WTL一樣,
難怪wxwidiget寧願巨集也不要用template,這樣也省下compiler的template編譯能力吧!
不過用cmake 跟 bjam編時要怎麼設定原始碼是unicode儲存的呀?不然一直編不過qq

smartwin++ 好像很久沒更新了,目前覺得最多範例的還是wx,雖然ultimatepp感覺很棒,
不過範例太少了,我喜歡用經過歷史考驗的東西。


讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

剛好我有學長有參加微軟xx計畫,有免費的vs2010專業版可以試用,就手殘灌了,這時要選2008就要打下面這一行qq

C:\clibrary\boost_1_42_0>bjam toolset=msvc-9.0 --build-type=complete

然後會跑出下面一堆話

Building the Boost C++ Libraries.

After the build, the headers will be located at

    C:\clibrary\boost_1_42_0

讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

應該是vista 64 的底層問題,因為在xp 32 測是沒有問題的。


讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

沒有巨集,沒有前置處理的部份,有異常的行為,
debug是正確,release"常常錯"。
沒有mem leak,總之超級奇怪的,總之解決了再說。
不是當掉,只是opengl畫的頂點位置錯了,顏色對了。
可是這兩個東西都是一起更新的。


讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

如果你今天在new過的空間中,使用了超過範圍的大小,那你將不能再new任何空間。


讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()

Problem 2.1. Write a merge sort in a bottom-up style (no recursive calls). Your code
should allow inputs of all lengths, that is, not just for inputs of 2k length.
Problem 2.2. (Slide no. 13 in the quicksort lecture) Implement a variant of quicksort
combining the skill of median-3 partition and using insertion sort on small subfiles.
The purpose is to decide the best parameter M.
When you submit your homework, you should include the following:
(a) Source code.
(b) A few examples (including a best case, a worst case and an average case;
also, inputs of different lengths for merge sort) and their sorting results, to
test the code’s accuracy.

讓地獄深紅的天亮 發表在 痞客邦 留言(2) 人氣()

1 23