自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 收藏
  • 关注

转载 stack的输入和弹出

#ifndef MAIN_SAVITCH_stack1_H#define MAIN_SAVITCH_stack1_H//#include #include #include #include #include #include#includeusing namespace std;namespace main_savitch_7A{ temp

2017-01-13 17:07:15 643

原创 txt文件的读取

//c 语言写法#include#includeint main(){ char szTest[1000]={0}; int len=0; FILE *fp=fopen("1.txt","r"); if (NULL == fp) {  printf("fail to open dos.txt \n");  return 1; } whil

2016-12-14 19:32:36 384

转载 寻找字符串的最长公共前缀

题目:Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.Subscribe to see which companies asked this question思路是这样的:2个字符串的最

2016-12-05 20:33:11 2007

原创 罗马数字转换成整数(注意罗马数字的大小表示问题)

罗马数字规则:1, 罗马数字共有7个,即I(1)、V(5)、X(10)、L(50)、C(100)、D(500)和M(1000)。罗马数字中没有“0”。2, 重复次数:一个罗马数字最多重复3次。3, 右加左减:在较大的罗马数字的右边记上较小的罗马数字,表示大数字加小数字。在较大的罗马数字的左边记上较小的罗马数字,表示大数字减小数字。4, 左减的数字有限制,仅限于I

2016-11-24 21:19:24 950

原创 比较的模板类

//模板类比较大小template//强制类型转换T2 Change(T1 a){ return T2(a);}template//比较大小T Max(T a,T b){ return(a>b?a:b);}template//强制类型转换(数据类型从低到高依次为: charT MyStatic_Cast(int a){ r

2016-11-24 20:35:45 307

原创 stack用于运算符的运算

//符号运算void evaluate_stack_tops(stack & numbers,stack & operations){double operand1,operand2;operand2=numbers.top();numbers.pop();operand1=numbers.top();numbers.pop();switch (operations.top()){case '+'

2016-11-24 20:31:29 527

原创 栈(stack)的应用实例——将一个数组逆序输出

#ifndef MAIN_SAVITCH_stack1_H#define MAIN_SAVITCH_stack1_H//#include #include #include #include #include #include#includeusing namespace std;namespace main_savitch_7A{templateclass stack{public:typede

2016-11-24 20:28:27 3843

原创 String to Integer(字符串转换成数字—leetcode)

题目:Implement atoi to convert a string to an integer.注意问题:1. 判断字符串是否为空字符串;2. long long 范围:[–9,223,372,036,854,775,808 - 9,223,372,036,854,775,807];3. 注意:不要漏了要判断+号的情况  ;4. isdigit--- 测试字符串 *

2016-11-21 22:12:56 1336

原创 Ziazag Conversion (曲折转换—leetcode)

题目:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L

2016-11-21 21:59:34 556

原创 字符串类 Mystring 中的四种基本函数

class MyString{public://默认构造函数MyString::MyString(){ m_data=NULL; m_size=0; m_capacity=0;}//析构函数MyString::~MyString(){ delete[]m_data;}//复制构造函数MyString::MyString(const c

2016-10-29 09:59:34 1520

原创 字符串复制函数 strcyp 复制的原型

//char*strDes 目标数据,constchar*strSrc 要复制的源数据char *strcyp(char*strDes,constchar*strSrc){   if(strDes==NULL || strSrc==NULL)   {       returnNULL;   }

2016-10-29 09:44:45 820 1

原创 计算字符个数及sizeof 与 strlen 的区别

(1)指针char *p="hello";coutsizeof(p)endl;cout strlen(p)endl;sizeof(p)结果为:4或8原因:32位系统下,指针的大小为4,64位系统下为8;strlen (p)结果为:5原因:字符串数组的大小为:字符个数。(2)数组charp[]="hell

2016-10-29 09:42:38 308

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除