fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int count(char* str,char chr)
  5. {
  6. if (*str==0)
  7. return 0;
  8. if(*str==chr)
  9. return 1+count(str+1,chr);
  10. else
  11. return 0+count(str+1,chr);
  12. }
  13. int main() {
  14. str a='12345';
  15. chr b='1';
  16. cout<<count(a,b);
  17. // your code goes here
  18. return 0;
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:14:8: warning: character constant too long for its type
  str a='12345';
        ^
prog.cpp: In function 'int main()':
prog.cpp:14:2: error: 'str' was not declared in this scope
  str a='12345';
  ^
prog.cpp:15:2: error: 'chr' was not declared in this scope
  chr b='1';
  ^
prog.cpp:16:14: error: 'a' was not declared in this scope
  cout<<count(a,b);
              ^
prog.cpp:16:16: error: 'b' was not declared in this scope
  cout<<count(a,b);
                ^
stdout
Standard output is empty