C programming project

FishBoy

Feeeesh
Joined
1 Aug 2004
Messages
1,685
hi i have to do some ascii buildings for a c programming projects it's all working great except that the windows go over the wall limit

i attached the picture of the output. i want it to stop drawing the windows if the last windows will go over the limit, what is the equation to let it not overflow, i know how to code good but i dont know how to do all the math parts in the coding

thanks guys
 

Attachments

  • ASCII.jpg
    ASCII.jpg
    57.8 KB · Views: 77
count each character as you append it maybe, and create each line that way, if its over a certain value then drop the wall over it
 
could you explain a little bit more please i kinda get what you mean but not really sure of what to do
 
left_padding + number_of_windows*window_width + (number_of_windows - 1)*intermediate_padding + right_padding compared to wall_width perhaps?
 
well it was something like having a basic counter controlling the whole thing and then you just append the character to the end of the string you are going to output. or you could do something where each time you append a new character to the string you check to see if the string is 1 less then the width of the house, if it is then you stick on the side wall and begin the next new line.

alternatively you could create the string of output, then check its length and if its longer than the width of the wall then you chop it one before the max width and stick the piece of wall in
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back