CMPC
Would you like to react to this message? Create an account in a few clicks or log in to continue.

PrintWall Program

2 posters

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

Go down

PrintWall Program Empty PrintWall Program

Post by Admin 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!
Admin
Admin
Pirate King

Posts : 559

Back to top Go down

PrintWall Program Empty Re: PrintWall Program

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

""Want your own frikin maze? FINE!"" AHAHAH!
Corey
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