fork download
  1. #include "mycstring.h"
  2.  
  3. using namespace std;
  4.  
  5. char* mycstring::mystrcopy(char *dest, const char *src){
  6. *dest=*src;
  7. return dest;
  8. }
  9.  
  10. char* mycstring::mystrcat(char *dest, const char *src){
  11. *dest+=*src;
  12. return dest;
  13. }
  14.  
  15. int mycstring::mystrcmp (const char *str1, const char *str2){
  16. if (*str1==*str2) return 0;
  17. else if (*str1>*str2) return 1;
  18. else return -1;
  19. }
  20.  
  21. const char* mycstring::mystrchr(const char *str, int c){
  22. if (str=="") return NULL;
  23. else if (str==c) return *str;
  24. else return mystrchr(str+1, c);
  25. }
  26.  
  27. char* mycstring::mystrchr (char *str, int c){
  28. if (str=="") return NULL;
  29. else if (str[0] == (char) c)
  30. return str;
  31. else return mystrchr(str+1, c);
  32. }
  33.  
  34. int mycstring::mystrlen (const char *str){
  35. if(str=="") return 0;
  36. else {
  37. count++;
  38. return count+mystrlen(str);
  39. }
  40. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:23: error: mycstring.h: No such file or directory
prog.cpp:5: error: ‘mycstring’ has not been declared
prog.cpp:10: error: ‘mycstring’ has not been declared
prog.cpp:15: error: ‘mycstring’ has not been declared
prog.cpp:21: error: ‘mycstring’ has not been declared
prog.cpp: In function ‘const char* mystrchr(const char*, int)’:
prog.cpp:22: warning: comparison with string literal results in unspecified behaviour
prog.cpp:22: error: ‘NULL’ was not declared in this scope
prog.cpp:23: error: ISO C++ forbids comparison between pointer and integer
prog.cpp:23: error: invalid conversion from ‘const char’ to ‘const char*’
prog.cpp: At global scope:
prog.cpp:27: error: ‘mycstring’ has not been declared
prog.cpp: In function ‘char* mystrchr(char*, int)’:
prog.cpp:28: warning: comparison with string literal results in unspecified behaviour
prog.cpp:28: error: ‘NULL’ was not declared in this scope
prog.cpp: At global scope:
prog.cpp:34: error: ‘mycstring’ has not been declared
prog.cpp: In function ‘int mystrlen(const char*)’:
prog.cpp:35: warning: comparison with string literal results in unspecified behaviour
prog.cpp:37: error: ‘count’ was not declared in this scope
stdout
Standard output is empty