Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2D Array Editor.
#1
This is quite an old projects.

Code:
#include <iostream>
using namespace std;
char map[10][11] = {{'+','-','-','-','-','-','-','-','+'},
                    {'|',' ',' ',' ',' ',' ',' ',' ','|'},
                    {'|',' ',' ',' ',' ',' ',' ',' ','|'},
                    {'|',' ',' ',' ',' ',' ',' ',' ','|'},
                    {'|',' ',' ',' ',' ',' ',' ',' ','|'},
                    {'|',' ',' ',' ',' ',' ',' ',' ','|'},
                    {'|',' ',' ',' ',' ',' ',' ',' ','|'},
                    {'|',' ',' ',' ',' ',' ',' ',' ','|'},
                    {'|',' ',' ',' ',' ',' ',' ',' ','|'},
                    {'+','-','-','-','-','-','-','-','+'}};
                  
int main()
{
    char kbinput;
    int x1 = 0, y1 = 0;
  
    while (true) {
    cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
          
        int x, y;
        for(x = 0; x <= 10; x++) {
            for (y = 0; y <= 10; y++)
                cout << map[x][y];
        cout << endl;
        }
      
        cout << "Input coordinates for x..." << endl;
        cin >> x1;
      
        cout << "Input coordinates for y..." << endl;
        cin >> y1;
      
        cout << x1 << " " << y1 << endl;
      
        cout << "Input Character" << endl;
        cin >> kbinput;
  
        map[x1][y1] = kbinput; // changed x to x1 and y to y1
    }
              
}
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Array Help[C++] se7en 2 661 12-11-2009, 12:06 AM
Last Post: Sagittarius
  Something absurdly wrong with char array J4P4NM4N 2 806 11-29-2009, 04:36 PM
Last Post: J4P4NM4N

Forum Jump:


Users browsing this thread: 1 Guest(s)