1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#include<iostream>
#include<ctime>
void draw_grid(); //declare function
//Name: Cian Feehan
//Project: Battleships Game
using namespace std;
char grid[5][5] = {{255}};
int main(){
draw_grid();
return 0;
}
//-----------------------------------------------------------------------------------------------------------------------
void draw_grid(){
int x,y;
char topl[25]={201,205,205,205,203,205,205,205,203,205,205,205,203,205,205,205,203,205,205,205,187};
char midl[25]={204,205,205,205,206,205,205,205,206,205,205,205,206,205,205,205,206,205,205,205,185};
char bottoml[25]={200,205,205,205,202,205,205,205,202,205,205,205,202,205,205,205,202,205,205,205,188};
//clrscr();
cout<<endl;
cout<<topl<<endl;
for(x=0;x<5;x++)
{
for(y=0;y<5;y++)
{
if(y==0)
cout<<char(186);
cout<<char(32)<<grid[x][y];
if (grid[x][y] <10)
cout<<char(32)<<char(186);
else
cout<<char(186);
}
cout<<endl;
if (x<4)
cout<<midl<<endl;
}
cout<<bottoml<<endl;
}
|