原创 VS2008下,CString與string互轉換,LPTSTR轉CString,char * 轉LPTSTR

   這個問題很糾結,由於unicode的緣故,搞得我這個新手很無奈。還好解決了,現將方式寫下,希望以後能找到更好的方法。   CString->string (需要兩次轉換)    string  C2S(CString cstr) {

原创 VS2008下mysql數據庫配置(使用c-api)

  配置說明: 使用數據庫爲MySQL,版本爲5.0.83 在VS2008中的配置如下:   1.工程屬性—》C/C++—》Ddditional Incluce Directories—》填入mysql目錄下的include文件夾地 址。

原创 MFC 獲取picture控件的鼠標點擊座標位置的方法

     在一個自定義的Dialog中加入了picture控件,想要獲取鼠標在該控件上的點擊位置,遇到一些困難,最終解決了。方法如下:      其實挺簡單的,首先用自定義的Dialog類重載CDialog的PreTranslateMes

原创 [LeetCode]Add Two Numbers

題目要求: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and

原创 [LeetCode]3Sum Closest

題目要求如下: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, targe

原创 OpenGL超級寶典6 學習環境配置

好久沒有寫博文了,最近覺得圖形學方面的知識非常缺乏,於是有了藉由《OpenGL超級寶典》第6版的學習來填補這方面空白的想法。目前已經看到第四章,打算自己動手重現一下書中的例子,加深一下印象。在環境搭建方面,參考了一些文章,也自己動手實踐了

原创 [LeetCode]Valid Parentheses

題目要求如下: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string

原创 [LeetCode]Longest Palindromic Substring

題目要求如下: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is

原创 [LeetCode]3Sum

題目要求如下: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique tripl

原创 [LeetCode]Remove Nth Node From End of List

題目要求: Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked lis

原创 [LeetCode]Generate Parentheses

題目要求如下: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For

原创 求最長迴文子串(Longest Palindromic Substring)

     求解最長迴文子串的問題最近經常遇到,特別是近期的筆試,因而有了一個學習的契機。先說說迴文字符串,迴文字符串的意思是從左往右看和從右往左看都是一樣的,即我們如果以中心爲軸,這個字符串是左右對稱的,如字符串"abcba","abba

原创 list iterator not decrementable

剛遇到這個“list iterator not decrementable”的問題,網上多數解決方案是這樣的: 意思就是在#include "stdafx.h"的下一行加上#define _HAS_ITERATOR_DEBUGGING

原创 [LeetCode]Palindrome Number

題目要求: Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be

原创 [LeetCode]Longest Common Prefix

題目要求如下: Write a function to find the longest common prefix string amongst an array of strings. 找出所有字符串的最長公共前綴。這道題很簡單,但需