fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. int count=0;
  8. int input[25][25];
  9. bool flag[25][25]={false};
  10.  
  11. cin >> count;
  12. cin.ignore();
  13.  
  14. for(int i=0;i<count;i++)
  15. {
  16. for(int j=0;j<count;j++)
  17. {
  18. string temp;
  19. cin>>temp;
  20. if(temp.compare('0')) input[i][j] = 0;
  21. else input[i][j] = 1;
  22. }
  23. cin.ignore();
  24. }
  25.  
  26. for(int i=0;i<count;i++)
  27. {
  28. for(int j=0;j<count;j++)
  29. {
  30. //if(!flag[i][j])
  31. cout << input[i][j];
  32. }
  33. cout << "" << endl;
  34. }
  35.  
  36.  
  37. return 0;
  38. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
7
0110100
0110101
1110101
0000111
0100000
0111110
0111000
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:20:23: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
    if(temp.compare('0')) input[i][j] = 0;
                       ^
In file included from /usr/include/c++/6/string:52:0,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/bits/basic_string.h:2493:7: note:   initializing argument 1 of ‘int std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::compare(const _CharT*) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
       compare(const _CharT* __s) const;
       ^~~~~~~
stdout
Standard output is empty