📄 testckit.cpp
字号:
// TestCKit.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int main(int argc, char* argv[])
{
printf("Hello World!\n");
return 0;
}
/* strlen(),计算字符串长度*/
int strlen(const char string)
{
int i=0;
while(string[i]) i++;
return i;
}
/*strcpy(), 字符串拷贝*/
char *strcpy(char *destination, const char *source)
{
while(*destinaton++=*source++);
return (destination-1);
}
/*strcat(), 字符串的连接.*/
char *strcat(char *target,const char *source)
{
char *original=target;
while(*target) target++; // Find the end of the string
while(*target++=*source++);
return(original);
}
/*streql(), 判断两个字符串是否相等.*/
int streql(char *str1,char *str2)
{
while((*str1==*str2)&&(*str1))
{
str1++;
str2++;
}
return((*str1==NULL)&&(*str2==NULL));
}
/* strchr(), 在字符串中查找某个字符.*/
char *strchr(const char *string,int letter)
{
while((*string!=letter)&(*string))
string++;
return (string);
}
/*chrcnt(), 计算某个字符在字符串中出现的次数.*/
int chrcnt(const char *string,int letter)
{
int count=0;
while(*string)
if(*string==letter)count++;
return count;
}
/*strcmp(), 判断两个字符串是否相等.*/
int strcmp(const char *str1,const char *str2)
{
while((*str1==*str2)&&(*str1))
{
str1++;
str2++;
}
if((*str1==*str2)&&(!*str1)) ile://Samestrings
return o;
else if((*str1)&&(!*str2)) ile://Samebut str1 longer
return -1;
else if((*str2)&&(!*str1)) file://Same but str2 longer
else
return((*str1>*str2)?-1:1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -