- 博客(38)
- 收藏
- 关注
原创 C/C++ const和volatile分析
const:现代的C编译器中的const将具有全局生命周期的变量储存于只读存储区const修饰局部变量是在栈上面分配空间(可以通过指针修改)const修饰的static局部变量是在只读存储区分配空间(无法修改)const 不能定义真正意义上的常亮,定义的是只读变量const修饰函数参数表示在函数体内不希望改变参数值const修饰函数返回值表示返回值不可以改变,多用于返回指针...
2018-08-01 21:01:41
300
原创 Map和vector使用,合并中英文
#include <iostream>#include <fstream>#include <string>#include <vector>#include <map>using namespace std;const string FILE_EN = "en.txt";const string FILE_CN = "cn.txt&quo
2018-06-29 18:10:09
469
原创 MFC 读写Excel
// MFCExcelDlg.cpp : 实现文件//#include "stdafx.h"#include "MFCExcel.h"#include "MFCExcelDlg.h"#include "afxdialogex.h"#include "CApplication.h"#include "CRange.h"#include "CWorkbook.h"#incl
2018-06-23 15:02:39
927
1
原创 Xsl.cpp
#include "StdAfx.h"#include "Xsl.h"namespace JWXml{ CXsl::CXsl(void) { } CXsl::~CXsl(void) { Close(); } //------------------------------------------------------------------------- // Function Name ...
2018-06-20 09:13:42
203
原创 XmlNodes
#include "StdAfx.h"#include "XmlNodes.h"namespace JWXml{ // constructors CXmlNodes::CXmlNodes(MSXML2::IXMLDOMNodeListPtr pNodeList) { m_pNodeList = pNodeList; } CXmlNodes::CXmlNodes(const CXmlNodes &...
2018-06-20 09:13:15
301
原创 XmlNode.cpp
#include "StdAfx.h"#include "xmlnode.h"namespace JWXml{ //------------------------------------------------------------------------- // Function Name :_GetValue // Parameter(s) :CString & st...
2018-06-20 09:12:47
276
原创 Xml.cpp
#include "StdAfx.h"#include "xml.h"#include <vector>namespace JWXml{ CXml::CXml(void) : m_strFilePath(_T("")) , m_pDoc(NULL) , m_emVersion(MSXML_UNKNOWN) { } CXml::~CXml(void) { Close(); } //--...
2018-06-20 09:11:06
267
原创 MFC编写的小工具
// toolDlg.cpp : 实现文件//#include "stdafx.h"#include "tool.h"#include "toolDlg.h"#include "afxdialogex.h"#include <vector>#include <string>#include "Xml.h"#include "XmlNode.h&
2018-06-20 09:10:10
995
原创 MFC 进制之前的转化
// MFC0XDlg.cpp : 实现文件//#include "stdafx.h"#include "MFC0X.h"#include "MFC0XDlg.h"#include "afxdialogex.h"#ifdef _DEBUG#define new DEBUG_NEW#endif// 用于应用程序“关于”菜单项的 CAboutDlg 对话框class CAboutDlg : publi...
2018-06-11 19:35:14
557
原创 C++ assign()函数的简单使用
#include <iostream>#include <string>#include <vector>#include <list>using namespace std;void assign_use(){ char *ac[] = {"liu","yu","dong","xiao","fa"
2018-05-29 15:20:11
8956
原创 C++ 提取、整理数据的工具
#include <iostream>#include <fstream>#include <vector>#include <string>#include <map>#include <assert.h>#include <io.h>#include <windows.h> #in
2018-05-18 16:27:55
745
原创 C++ 整理txt文件的小工具 对文件格式处理
#include <iostream>#include <fstream>#include <vector>#include <string>#include <map>using namespace std;const int ID_SIZE=5;//根据相应的模式进行选择struct DADE{ vector<string>...
2018-05-17 13:25:54
554
原创 C++整理大数据文件vector
#include <iostream>#include <fstream>#include <string>#include <vector>#include <map>struct MyDate{ string str1; string str2;// string str3;};int strGetDate(){ ifstream f...
2018-05-16 16:59:11
529
原创 C++ 读、写、整理大数据到新文件
#include <iostream>#include <fstream>#include <string>#include <vector>#include <map>using namespace std;const int ID_SIZE = 2;//对处理当前文本库中的ID的位数定义,test.txt中使用5个byte。struc...
2018-05-16 16:57:26
1310
原创 Python 删除文件和文件名特定字符
#coding=utf-8import osimport stringdef re_file(): path = os.getcwd() #filelist = os.listdir(path) #该文件夹下所有的文件(包括文件夹) for root, dirs,files in os.walk(path): for name in files: #遍历所有文件 pathname = os...
2018-05-15 10:40:58
6410
原创 Python 修改文件夹下所有文件指定字符串
def re_name(): path="E:\\XML" filelist = os.listdir(path) #该文件夹下所有的文件(包括文件夹) for files in filelist: #遍历所有文件 pos = files.find(".tab.out") if (pos == -1): continue ne...
2018-05-14 17:21:51
565
原创 Python 查找某个目录下面的文件个文件夹(递归)os.walk方法
import osimport fnmatchdef all_files(root, patterns= '*', single_level = False, yield_folders = False): patterns = patterns.split(';') for path, subdirs,files in os.walk(root): if yield_f...
2018-05-09 14:17:29
1540
原创 Python 移动光标位置
x = file('1.txt','r')print x.tell() #显示当前光标位置x.seek(3)print x.tell() #没有设置光标位置,默认从头开始移动3个位置x.seek(5, 1)print x.tell() #从当前开始移动5个位置x.seek(2, 2)print x.tell() #从末尾开始向前移动2个位置...
2018-05-09 10:37:28
13180
原创 去掉字符串中的空格
s1 = " fdsf dsffsdf "print s1.lstrip() #去掉左边的空格s2 = " edsfsdf dsf "print s2.rstrip() #去掉右边的空格s3 = " dsfdsaf sdfd sdsf "print s3.strip() #去掉两边的空格s4 = " dsfdsaf sdfd sdsf "print s4.replace(' ', ...
2018-05-09 10:33:14
245
原创 linecache读取大文件
# coding=utf-8import osimport linecachedef get_content(path): '''读取缓存中文件内容,以字符串形式返回''' if os.path.exists(path): content = '' cache_data = linecache.getlines(path) for line i...
2018-05-09 10:11:57
540
原创 Python完全平方数,编程练习题实例三
题目:一个整数,它加上100 后是一个完全平方数,再加上168 又是一个完全平方数,请问该数是多少?import mathfor i in range(1, 10001): x = int(math.sqrt(i + 100)) #转化为整型值 y = int(math.sqrt(i + 268)) #转化为整型值 if (x * x) == (i + 100) a...
2018-05-02 15:53:04
1209
1
原创 Python数轴编程练习题实例二
题目:企业发放的奖金根据利润提成。利润(I) :低于或等于10 万元时,奖金可提10%;高于10 万元,低于20 万元时,低于10 万元的部分按10%提成,高于10万元的部分,可提成7.5%;20 万到40 万之间时,高于20 万元的部分,可提成5%;40 万到60 万之间时,高于40 万元的部分,可提成3%;60 万到100 万之间时,高于60 万元的部分,可提成1.5%,高于100 万元时,超...
2018-05-02 14:28:45
1638
1
原创 【程序1】 题目:有1、2、3、4 个数字,能组成多少个互不相同且无重复数字的三位数?都是多 少?
import osa = 0for i in range(1,5): for j in range(1,5): for k in range(1,5): if (i!=j) and (i!= k) and (j!=k): print i,j,k a+=1print a#===>结果:24个互...
2018-04-28 09:50:53
1676
原创 Python 对象操作家具()
#coding = utf-8class Home: def __init__(self,new_area,new_info,new_addr): self.area = new_area self.info = new_info self.addr = new_addr self.left_area = new_area self.contain_item = [] def __s...
2018-04-16 16:32:46
493
原创 Python 对象烤地瓜
#coding = uft-8class Sweetpotato: def __init__(self): self.cookedString = "生的" self.cookedLevel = 0 self.condiments = [] def __str__(self): return "地瓜 状态:%s(%d),添加的作料有:%s"%(self.cookedString,sel...
2018-04-16 15:57:27
340
原创 Python 大文件操作
old_file_name = input("请输入要复制的文件名(需要后缀)")f_read = open(old_file_name,"r")position = old_file_name.rfind(".")nwe_file_name = old_file_name[0:position]+"[复件]"+old_file_name[position:]f_write = open (nwe...
2018-04-16 09:48:59
399
原创 Python return 的使用
def test(): a=11 b=22 c=33 #用一个链表封装三个变量的值 #d=[a,b,c] # return d #return [a,b,c] #直接返回一个整体 #return (a,b,c) return a,b,c #默认封装成元组 进行返回num=test()print(num)num=test()print(num)...
2018-04-08 22:56:30
1181
原创 Python 封装
def print_fozu(): #打一个代码封装成一个函数 print(" _ooOoo_ ") print(" o8888888o ") print(" 88 . 88 ") print(" ...
2018-04-08 22:02:22
965
原创 Python 元组
#元组的数据只能读取,不能修改 num(11,22,33)#列表既能读取也能修改 num[11,22,33]len keys(键值) get values(值) items(封装成元组)
2018-04-08 21:38:18
86
原创 Python 中append‘和extend的区别
a=[11,22,33]b=[44,55]a.extend(b)print(a) #---->[11, 22, 33, 44, 55] extend 是不b中的元素一个个加到a中a.append(b)print(a) #--->[11, 22, 33, 44, 55, [44, 55]] append 是把b当作整体加到a中a=a.app...
2018-04-08 21:18:45
577
原创 python for注意一些技巧
nums=[11,22,33,44]for num innums print(num) #--->相比while 不需要知道nums 的长度就可以遍历
2018-04-08 21:11:07
212
原创 Python 实现一个名片管理系统
#coding = uft-8#1.打印功能提示print("="*50)print(" 名片管理系统 V0.01")print("1.添加一个新名片")print("2.删除一个名片")print("3.修改一个名片")print("4.查询一个名片")print("5.显示所有的名片")print("6.退出系统")print("=&
2018-04-07 15:41:09
3104
1
原创 Python 剪刀石头布 小游戏
#1.提示并获取用户的输入import random #导入一个工具箱player = int (input ("请输入 0剪刀 1石头 2布:"))#2.让电脑出一个#conputer = 1conputer = random.randint(0,2) #电脑从0-2随机出一个数if player == 0 and conputer == 2 or player ==1 and conputer...
2018-04-07 14:14:58
665
原创 Python 赋值运算符
a=3a+=4a*=34-31+44-22 #---->a=a*(34-31+44-22)=175print("a=%d"%a) #--->175这里特别注意是想计算完=号右边的再计算 *
2018-04-07 11:35:55
752
原创 Python的print函数
i=1while i<=5: j=1 while j<=5: print("*",end=" ") j=j+1 print(" ") i=i+1通过以上函数打印出一个5*5的矩阵在print函数里面运用 end=" "进行不换行的操作;再通过print(" "),进行打印完5个*之后进行换行操作。深入练习 printi=1while i<=5: j=1 while
2018-04-07 11:28:32
1434
原创 运维开发第一课
1.首先熟悉Linux 的一些基本命令 ls cd chmod 等等2.可以去网上找一些简单的服务进行搭建;3.搭建好完整的服务之后,去理解每一个服务的完整配置和优化;4.平时都看一下大神写的shell,自己跟着多练习;5.写一个自己的博客,打自己的工作和学习的知识记录到博客;6.把Linux的基本服务弄明白后,多钻研web集群方面的东西,例如:Nginx、Tomact、Mysql集群、Redis...
2018-04-03 11:34:28
133
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人