自己的比较拷贝连接函数~ :: 我的工作

自己的比较拷贝连接函数~ 时间: 2004-08-18 // test713.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <stdio.h> #include <iostream.h> int result; void my_strcat(char* a,const char* b) { int i=0; int k=0; while (a[i]!='\0') { i++; } while (b[k]!='\0') { a[i]=b[k]; i++; k++; } a[i]='\0'; } int my_strcmp(const char* a, const char* b) { int i=0; int k=0; if(a[i]!='\0'&&b[k]!='\0') {while ( 1  ) { result=(a[i]-b[k]); if(result==0) { i++; k++; }break; } return result; } else printf("input two string the same length!"); } void my_strcpy(char* a, const char* b) { int i=0; int k=0; while(b[k]!='\0') { a[i]=b[k]; i++; k++; } a[i]=b[k]; } int main( ) { char s1 [100]; printf ( "input s1\n" ); scanf ( "%s",s1 ); char s2 [100]; printf( "input s2\n" ); scanf ( "%s",s2 ); my_strcat( s1,s2 ); cout <<" new_s1\n: " <<s1 <<" \n "; cout << my_strcmp( s1,s2 )<< "\n"; my_strcpy( s1,s2 ); cout << "new_s1\n:" << s1 << "\n"; return 0; } chifanhezhou 引用(Trackback0) | 编辑 评论 发表评论 用户名: Email: 主页: 最后更新 bash:emv_backup.sh-version1.2 今天写的bash:emv_backup.sh 编写bash脚本实战~ sep19tips~ 18号的一些提示~ 17号任务~ 16号工作总结和材料 16号工作~ knoppix使用方法~ 15号的任务,学习使用cvs~

原始快照:web.archive.org