My include's I know its just Dev C++ wont allow me to do it without the .h it gives me errors like windows no such directory. So i just do windows.h and it works. Its not like it makes alot of difference!
Anyway here is my revised code:
Code:
#include <stdlib.h>
#include <iostream>
#include <windows.h>
#include <conio.c>
#include <time.h>
int arraybox[7][10];
void drawred();
void drawbrown();
void drawyellow();
void drawwhite();
void drawpurple();
void drawgreen();
void drawside();
void cl(int);
char* square = "\n|###|\n|###|\n|###|";
int random(int,int);
int main()
{
drawside();
getch();
return 0;
}
int random(int low, int high)
{
srand(time(NULL));
return low + rand()%(high-low+1);
}
void cl(int cl){
switch(cl)
{
case 1:
drawred();
break;
case 2:
drawbrown();
break;
case 3:
drawyellow();
break;
case 4:
drawwhite();
break;
case 5:
drawpurple();
break;
case 6:
drawbrown();
break;
}
}
void drawred(){
textcolor(RED);for( int l = 0; l < 7; l ++){
cout<<endl;
for( int w = 0; w< 10; w ++){
cout<<static_cast<char>(arraybox[l][w] = 177);
}
}}
void drawbrown(){
textcolor(BROWN);for( int l = 0; l < 7; l ++){
cout<<endl;
for( int w = 0; w< 10; w ++){
cout<<static_cast<char>(arraybox[l][w] = 177);
}
}}
void drawyellow(){textcolor(YELLOW);for( int l = 0; l < 7; l ++){
cout<<endl;
for( int w = 0; w< 10; w ++){
cout<<static_cast<char>(arraybox[l][w] = 177);
}
}}
void drawwhite(){textcolor(WHITE);for( int l = 0; l < 7; l ++){
cout<<endl;
for( int w = 0; w< 10; w ++){
cout<<static_cast<char>(arraybox[l][w] = 177);
}
}}
void drawpurple(){textcolor(MAGENTA);for( int l = 0; l < 7; l ++){
cout<<endl;
for( int w = 0; w< 10; w ++){
cout<<static_cast<char>(arraybox[l][w] = 177);
}
}}
void drawgreen(){textcolor(GREEN);for( int l = 0; l < 7; l ++){
cout<<endl;
for( int w = 0; w< 10; w ++){
cout<<static_cast<char>(arraybox[l][w] = 177);
}
}}
void drawside()
{
cl(random(1,6));
}
I know how to make three squares down:
Code:
cl(random(1,6));
cl(random(1,6));
cl(random(1,6));
but what if I want them along side:
|###| |###| |###|
|###| |###| |###|
|###| |###| |###|
It wont alow me! I tried everything!
[EDIT]
And even if I do:
Code:
cl(random(1,6));
cout<<endl;
cl(random(1,6));
cout<<endl;
cl(random(1,6));
It gives me three the same square's
[/EDIT]