Skip to content

Instantly share code, notes, and snippets.

@dz0
Last active October 28, 2016 07:34
Show Gist options
  • Select an option

  • Save dz0/a448f4d3d93d4ed7411b9a647b2e7c24 to your computer and use it in GitHub Desktop.

Select an option

Save dz0/a448f4d3d93d4ed7411b9a647b2e7c24 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
/**
* Don't let the machines win. You are humanity's last hope...
**/
int main()
{
char M[30][30]; // naudosim simbolių ("char") matricą
int width; // the number of cells on the X axis
cin >> width; cin.ignore();
int height; // the number of cells on the Y axis
cin >> height; cin.ignore();
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++){
cin >> M[i][j]; // skaitom po vieną simbolį // nebereikia getline(cin... )
cerr << M[i][j]; // Pasitikrinam,ar gerai nuskaitė
}
cerr << endl;
cin.ignore(); // kad peršoktų į kt. eilutę
}
// nuskaičius duomenis į matricą, bus galima ją analizuot
// C++ simbolis ("char" tipo) yra rašomas tarp viengubų kabučių, pvz: '0' , 'a' , '.'
// if( M[i][j]=='0' )
// arba
// if( M[i][j]=='.' )
// To debug: cerr << "Debug messages..." << endl;
// Three coordinates: a node, its right neighbor, its bottom neighbor
cout << "???" << endl; // kiekvieno kareivuko ir jo kaimynų koordinatės...
// PS: atsakyme reik pirmiau rašyt st. nr., o paskui eil. nr.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment