码迷,mamicode.com
首页 >  
搜索关键字:char    ( 35907个结果
LeetCode Length of Last Word
class Solution {public: int lengthOfLastWord(const char *s) { if (s == NULL) return 0; int mlen = 0, len = 0; bool inword = fa...
分类:其他好文   时间:2014-06-29 14:13:37    阅读次数:229
[C/C++基础] C语言常用函数strlen的使用方法
函数声明:extern unsigned int strlen(char *s);所属函数库:功能:返回s所指的字符串的长度,其中字符串必须以’\0’结尾参数:s为字符串的初始地址使用举例:代码如下编译运行结果说明:函数strlen比较容易理解,其功能和sizeof很容易混淆。其中sizeof指的是...
分类:编程语言   时间:2014-06-29 13:55:04    阅读次数:302
time ctime
time_t time(time_t *t);如果t是空指针,直接返回当前时间。如果t不是空指针,返回当前时间的同时,将返回值赋予t指向的内存空间。函数: ctime功 能: 把日期和时间转换为字符串用 法: char *ctime(const time_t *time);#include#incl...
分类:其他好文   时间:2014-06-07 06:01:02    阅读次数:169
Leetcode Letter Combinations of a Phone Number
const char* lookup[] = {" ", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxy...
分类:其他好文   时间:2014-06-07 05:04:11    阅读次数:192
编写一个函数char_contains(char str[],char c), 如果字符串str中包含字符c则返回数值1,否则返回数值0
/*编写一个函数char_contains(charstr[],charc),如果字符串str中包含字符c则返回数值1,否则返回数值0*/#include#include//可读性->性能->精简(重构)intchar_contains(charstr[],charc);intmain(){//in...
分类:其他好文   时间:2014-05-28 16:42:03    阅读次数:290
(不包括\0) 编写一个int string_len(char *s), 返回字符串s的字符长度
#include /* (不包括\0) 编写一个int string_len(char *s),返回字符串s的字符长度 */int string_len(char *s);int main() { //char *name = "itcast"; // 男 \u434\u4343\u434...
分类:其他好文   时间:2014-05-28 15:13:24    阅读次数:172
三个 编程题 :1. 回文 2. 将字符串t连接到字符串s的尾部
/*编写一个函数,判断某个字符串是否为回文。回文就是从左边开始读 和 从右边开始读 都是一样的,比如"abcba"*/#include #include int isHuiwen(char *str);int main(){ printf("%d\n", isHuiwen("a")); ...
分类:其他好文   时间:2014-05-28 15:11:59    阅读次数:299
Wargame narnia level 2 (中文攻略)
前面省略连接部分…… cat narnia2.c #include #include #include int main(int argc, char * argv[]){ char buf[128]; if(argc == 1){ printf("Usage: %s argument\n", ar...
分类:其他好文   时间:2014-05-28 11:49:49    阅读次数:560
fopen()和fclose()的用法
1.fopen()函数的用法fopen函数用于打开文件, 其调用格式为:FILE *fopen(char *filename, *type);fopen()函数中第一个形式参数表示文件名, 可以包含路径和文件名两部分。如:"B:TEST.DAT""C:\\TC\\TEST.DAT"注意:如果将路径写...
分类:其他好文   时间:2014-05-28 10:12:08    阅读次数:316
DLL
1 typedef IUnknown * (* CREATEFUNCPTR)(); 2 3 IUnknown * CallCreateInstance(char * name) 4 { 5 HINSTANCE hComponent = ::LoadLibrary(name); 6 ...
分类:其他好文   时间:2014-05-28 09:51:43    阅读次数:176
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!