fork(2) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void main()
  6. {
  7. char a;
  8. int b;
  9.  
  10. cout << "Input first coordinate (characters from 'a' to 'h'): ";
  11. cin >> a;
  12.  
  13. cout << "Input second coordinate(numbers from 1 to 8) : ";
  14. cin >> b;
  15.  
  16. for (int i = 1; i <= 8; ++i)
  17. {
  18. if (i == 1)
  19. {
  20. cout << " ";
  21.  
  22. for (char j = 'a'; j <= 'h'; ++j)
  23. {
  24. cout << j;
  25. }
  26. }
  27.  
  28. cout << endl << i;
  29.  
  30. for (char j = 'a'; j <= 'h'; ++j)
  31. {
  32. for (int z = 1; z < 8; ++z)
  33. {
  34. if ((j == a - z && i == b - z) || (j == a + z && i == b + z) || (j == a - z && i == b + z) || (j == a + z && i == b - z))
  35. {
  36. cout << "*";
  37. }
  38. }
  39.  
  40. if (j == a && i == b)
  41. {
  42. cout << "B";
  43. }
  44. else
  45. {
  46. cout << " ";
  47. }
  48. }
  49. }
  50. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:5:11: error: '::main' must return 'int'
 void main()
           ^
stdout
Standard output is empty