Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(i = 0; (i < 9); i++)
- {
- for(j = 0; j < 9; j++)
- {
- //cout << " " << Matrix[i][j];
- //cout << "i: " << i << endl;
- if(Matrix[i][j] == 0)
- {
- //temp = 10;
- [goto] ;
- //break;
- }
- }
- }
- int i,j;
- for(i = 0; i < 9; i++)
- {
- for(j = 0; j < 9; j++)
- {
- //cout << " " << Matrix[i][j];
- //cout << "i: " << i << endl;
- if(Matrix[i][j] == 0)
- {
- //temp = 10;
- goto end;
- //break;
- }
- }
- }
- end:
- cout << i << " " << j << endl;
- for (/* ... */) {
- /* ... */
- if (/* ... */)
- goto finalise;
- }
- finalise:
- foo = bar; //...
- inline std::pair<int,int> findZeroEntry(std::vector matrix) {
- for (int i = 0; i < 9; i++)
- for (int j = 0; j < 9; j++)
- if (Matrix[i][j] == 0)
- return std::make_pair(i,j);
- return std::make_pair(9,9); // error
- }
- Matrix m;
- Index2D< 9, 9 > pos;
- for( ; pos < pos.end(); ++pos )
- {
- if( m( pos.x(), pos.y() ) == 0 )
- {
- break;
- }
- }
- cout << pos.x() << " " << pos.y() << endl;
- Matrix m;
- Index2D< 9, 9 > pos;
- for( ; pos < pos.end(); ++pos )
- {
- if( m[pos] == 0 )
- {
- break;
- }
- }
- cout << pos.x() << " " << pos.y() << endl;
- template< int width, int height >
- struct Index2D
- {
- int i_;
- int x() const { return i_ % width; }
- int y() const { return i_ / width; }
- void operator++() { ++i_; }
- bool operator<( Index2D const& other ) const
- {
- return (i_ < other.i_);
- }
- Index2D(): i_( 0 ) {}
- Index2D( int const x, int const y )
- : i_( width*y + x )
- {}
- static const Index2D endValue;
- static Index2D end() { return endValue; }
- };
- template< int width, int height >
- Index2D< width, height > const Index2D< width, height >::endValue( 0, height );
- bool HasFoundZero = false;
- for(i = 0; i < 9; i++)
- {
- for(j = 0; j < 9; j++)
- {
- //cout << " " << Matrix[i][j];
- //cout << "i: " << i << endl;
- if(Matrix[i][j] == 0)
- {
- //temp = 10;
- HasFoundZero = true;
- }
- if(HasFoundZero)
- {
- break;
- }
- }
- if(HasFoundZero)
- {
- break;
- }
- }
Add Comment
Please, Sign In to add comment