PrintWall Program
2 posters
CMPC :: Computing :: Programming :: C++
Page 1 of 1
PrintWall Program
Here is something I made just for fun to see what would come up and how it would look.
It just prints a pattern onto the command prompt screen and I called it "PrintWall" because I thought it would look like a wall. Not even close!
Hope you have fun with that. I encourage tweaking!
It just prints a pattern onto the command prompt screen and I called it "PrintWall" because I thought it would look like a wall. Not even close!
- Code:
#include <iostream>
#include <ctime>
#include <cstdlib>
int randnum(int lownum, int highnum)
{
return (rand()%(highnum+1)+lownum);
}
int printwall()
{
int x=randnum(1,4);
if(x==1)
{
std::cout<<"\\";
}
else if(x==2)
{
std::cout<<"//";
}
else if(x==3)
{
std::cout<<"||";
}
else if(x==4)
{
std::cout<<"----";
}
return 0;
}
int main()
{
srand((unsigned)time(0));
int i;
std::cout<<"Want your own frikin maze? FINE!\n";
std::cout<<"How many walls do you want?";
std::cin>>i;
for(int a=0;a<=i;a++)
{
std::cout<<printwall()<<"\n";
}
system("pause");
return 0;
}
Hope you have fun with that. I encourage tweaking!
Admin- Pirate King
- Posts : 559
CMPC :: Computing :: Programming :: C++
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|