PrintWall Program

CMPC :: Computing :: Programming :: C++

Go down

PrintWall Program

Post by Admin on Wed Dec 02, 2009 12:28 am

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. Razz 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!
avatar
Admin
Pirate King

Posts : 559

Back to top Go down

Re: PrintWall Program

Post by Corey on Wed Dec 02, 2009 5:20 am

""Want your own frikin maze? FINE!"" AHAHAH!
avatar
Corey
Mod

Posts : 462

Back to top Go down

Back to top

- Similar topics

CMPC :: Computing :: Programming :: C++

 
Permissions in this forum:
You cannot reply to topics in this forum