
C++/C学习
文章平均质量分 85
zjjfish
这个作者很懒,什么都没留下…
展开
-
wchar_t与char类型的转换
C++标准中,wchar_t是宽字符类型,每个wchar_t类型占2个字节,16位宽。汉字的表示就要用到wchar_t 。char,我们都知道,占一个字节,8位宽。其实知道了这个以后,要在wchar_t 和 char两种类型之间转换就不难实现了。#include #include using namespace std;void WtoC(wchar_t w_cn,char原创 2009-10-11 12:23:00 · 915 阅读 · 1 评论 -
STL和c++、MFC之间是什么关系?
C++是一种编程语言,可以支持成面向过程,或者基于过程,或者面向对象设计方法; STL(standard template library,标准模板库)是C++标准程序库,提供处了基本的数据类型int char,还有扩展的用类实现的容器类型如vector,list等标准泛型容器类型,以及一些通用的泛型算法; MFC,一个framework,用面向对象的方法,来封装win32 API来进原创 2009-10-11 12:09:00 · 1246 阅读 · 0 评论 -
c++学习中replace的一种用法
//将iamhappy中的a全部换成b#include "stdafx.h"#include #include #include #include using namespace std;string string_replace(string resource,string re_str,string dis_str){ string abc=re原创 2009-10-11 12:16:00 · 857 阅读 · 0 评论 -
如何解决unexpected end of file while looking for precompiled header directive的问题
今天下午写程序遇到一个错误找了好久才找出来,原来,不小心将#include "stdafx.h"删除了,找了好久才找出来解决方法如下:右键点工程名,选设置,然后选c/c++属性页,再选catagory选单中选 precompiled header ,将选项置成no use 或者autometic原创 2009-10-11 16:33:00 · 952 阅读 · 0 评论 -
常见的字符串和数的转换(C)
1. 字符串转换为数字:头文件 #include atof()将字符串转化为浮点数; //atof("1.2e4") 124000.000000 atoi()将字符串转化为整型数; atol()将字符串转化为长整型数; strtod()将字符串转化为浮点数; strtod(" 2.4124",&str) 2.412400 strtod("1000",NULL,2) 最后一位为进制 str原创 2010-08-17 22:20:00 · 690 阅读 · 0 评论 -
链表逆置
<br />链表逆置(linux下面中文输入法不好使,勿见怪)<br />一种方法:每次从原链表取出一个节点,逆序建立里一个新的链表<br /> <br />//逆置之后没有头节点pNode Reverse(pNode head){ pNode ptr = (pNode)malloc(sizeof(Node)),p = head->next, q = p->next; ptr->next = NULL; while(q) { pNode r = p; r->next =原创 2011-06-01 20:10:00 · 405 阅读 · 0 评论