I got a question from my friends sister's boyfriend. He made a rubix game in C++ and at that time I was looking for new program Idea's he said give it a try so I did only to find out I find it nearly impossible to do.
This is how far I got:
This prints 3 squares down wards in ALL THE SAME COLOR which is not what i intented it to do I want them to all appear in different colors but some how they wont. Can anybody help me out here and what would be the best way to make a full side. ThanxCode:#include <stdlib.h>
#include <iostream>
#include <windows.h>
#include <conio.c>
#include <time.h>
void drawred();
void drawbrown();
void drawyellow();
void drawwhite();
void drawpurple();
void drawgreen();
void drawside();
void cl(int);
char* square = "|###|\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:
drawred();
break;
case 3:
drawred();
break;
case 4:
drawred();
break;
case 5:
drawred();
break;
case 6:
drawred();
break;
}
}
void drawred(){textcolor(RED);cout<<square<<"\n";}
void drawbrown(){textcolor(BROWN);cout<<square<<"\n";}
void drawyellow(){textcolor(YELLOW);cout<<square<<"\n";}
void drawwhite(){textcolor(WHITE);cout<<square<<"\n";}
void drawpurple(){textcolor(MAGENTA);cout<<square<<"\n";}
void drawgreen(){textcolor(GREEN);cout<<square<<"\n";}
void drawside()
{
cl(random(1,6));
cout<<endl;
cl(random(1,6));
cout<<endl;
cl(random(1,6));
cout<<endl;
}
-Devouring One-