Hello everyone, I am trying to get back in programing. I started learning in college, and pretty much forgot everything I learned. I was wondering if anyone wouldn't mind taking a look at my stuff, all I did was make a map of x by y, then spit it out. I am using the free bloodshed compiler.
Does anyone know of any sites that has any good homework type exercises? I try to think up my own but it gets pretty tough. There was also a function that you could put the text anywere on the screen you want to... but I can't seem to find it anywere.
Code:
//attempt at making a map with array's
#include <iostream>
#include <stdlib.h>
using namespace std;
void spitmap();
void makemapnum(int x, int y);
int x=0,y=0;
int xcount=0;
int place[5000][5000]; // [x],[y] MAKE GLOBAL
int main(int argc, char *argv[])
{
cout<<"Please enter how wide you want the map. :";
cin>>x;
cout<<"Please enter how long you want the map. :";
cin>>y;
spitmap(); //spits out map
makemapnum(x,y);
system("PAUSE");
return 0;
}
void spitmap()
{
for(int counter=0; counter<y; counter++)
{
do
{
cout<<"O";
xcount++;
}
while(xcount<x);
xcount=0;
cout<<" "<<counter+1<<endl;
}
for(int counter=0;counter<x;counter++)
{
cout<<counter+1;
}
}
void makemapnum(int x,int y) // counting on the map
{
int count_x=0, count_y=0;
int placecount=0;
for(int count_y=0; count_y<y; count_y++)
{
do
{
place[count_x][count_y]=placecount;
count_x++;
placecount++;
}while(count_x+1<x);
placecount++;
cout<<endl<<placecount<<" place["<<count_x<<"]["<<count_y<<"]";
count_x=0; // resetting count_x for next moving
}
}