Open Hsue66 opened 4 years ago
/*#include using namespace std;
int ztrlen(char str) { int c = 0; while (str++) c++; return c; }
void ztrcpy(char dst, char src) { while (dst++ = src++); }
int ztrcmp(char s1, chars2) { int c = 0; while (s1[c] != '\0') { if (s1[c] != s2[c]) break; c++; } return s1[c] - s2[c]; }
int main() { char arr[6] = "hello"; cout << ztrlen(arr) << endl; char arr2[6]; ztrcpy(arr2, arr); cout << arr2 << endl; cout << ztrcmp(arr, arr2) << endl; cout << ztrcmp(arr, (char)"hel") << endl; cout << ztrcmp((char)"hel", arr) << endl; } */
/*#include
using namespace std;
int ztrlen(char str) { int c = 0; while (str++) c++; return c; }
void ztrcpy(char dst, char src) { while (dst++ = src++); }
int ztrcmp(char s1, chars2) { int c = 0; while (s1[c] != '\0') { if (s1[c] != s2[c]) break; c++; } return s1[c] - s2[c]; }
int main() { char arr[6] = "hello"; cout << ztrlen(arr) << endl; char arr2[6]; ztrcpy(arr2, arr); cout << arr2 << endl; cout << ztrcmp(arr, arr2) << endl; cout << ztrcmp(arr, (char)"hel") << endl; cout << ztrcmp((char)"hel", arr) << endl; } */