[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
>implying /g/ can output a triangle like this with code.
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 29
Thread images: 2
File: Untitled.png (2 KB, 542x424) Image search: [Google]
Untitled.png
2 KB, 542x424
>implying /g/ can output a triangle like this with code.
>>
>>52050063
wget http://i.4cdn.org/g/1451062609822.png
mv 1451062609822.png output.png


what now, faggot
>>
>>52050086
You just for rekt OP
>>
>>52050086
>platform dependent
top kek
>>
>>52050086
without internet access or relying on premade modules
>>
>>52050099
>>52050098
>moving the goalposts
>>
>>52050086
wget http://i.4cdn.org/g/1451062609822.png -O output.png

fag
>>
>>52050086
-O output.png, no mv needed
>>
>>52050063
main() {
//char c[3] = "\0\0\0";
const char a[8] = " *";
const char b[8] = " * *";
const char c[8] = " * * *";
const char d[8] = " * * * *";
const char e[1] = "\n";
_write(1,a,8);
_write(1,e,1);
_write(1,b,8);
_write(1,e,1);
_write(1,c,8);
_write(1,e,1);
_write(1,d,8);
_write(1,e,1);
return 0;
}


Who's >implying now, huh?
>>
>>52050063
just use decreasing amounts of spacing in a for-loop, or just print 4 lines if you want to be extra cheeky about it
>>
>>52050063
Hey, OP. Look. It might almost be 2016, but remember you are not that far into your first year of computer science. These are fundamentals, though. Don't ask /g/ for a solution to your homework, ask one of your little university buddies to explain to you how it actually works.
If you can't solve this and you are not willing to learn, you will drop out next year.
>>
File: Triangle.png (4 KB, 669x338) Image search: [Google]
Triangle.png
4 KB, 669x338
@echo off
echo o
echo o o
echo o o o
echo o o o o
echo.
pause
>>
puts '   .'
puts ' ..'
puts ' ...'
puts '....'

done
>>
>newfags cant triforce /g/ edition
>>
>>52050132
>unsafe const declarations
Might as well be writing assembly.
//#include <stdlib.h>
main() {
const volatile unsigned char a[8] = 1?" *":"\0\0\0\0\0\0\0\0";
const volatile unsigned char b[8] = 1?" * *":"\0\0\0\0\0\0\0\0";
const volatile unsigned char c[8] = 1?" * * *":"\0\0\0\0\0\0\0\0";
const volatile unsigned char d[8] = 1?" * * * *":"\0\0\0\0\0\0\0\0";
const volatile unsigned char e[1] = 1?"\n":"\0";
if(!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1)
{
_write(1,a,8);
_write(1,e,1);
_write(1,b,8);
_write(1,e,1);
_write(1,c,8);
_write(1,e,1);
_write(1,d,8);
_write(1,e,1);
} else {
goto x;
}
x: return 0;
}
>>
>>> meme(4)
.
..
...
....
>>> def meme(ayy):
... for x in range(ayy):
... print ' ' * (ayy - x) + '.' * (x+1)
...
>>> meme(1)
.
>>> meme(4)
.
..
...
....
>>> meme(10)
.
..
...
....
.....
......
.......
........
.........
..........
>>>

merry christmas, anon
>>
>>52050382
>print ' ' * (ayy - x) + '.' * (x+1)
I wish Java would let you multiply print statements
>>
>>52050063
I'm confused

do you want me to generate a bitmap that closely resembles that poorly aligned triangle in your image?
>>
>>52050487
Exactly
>>
>>52050086
This isn't fucking code, its terminal commands.

OP beat you
>>
>>52050291
Kek
>>
>>52050376
You kek'd me good anon.
>>
for i in xrange(5):
for j in xrange(5 - i):
print(' '),
for j in xrange(i):
print('x'),
print('')
>>
ezpz

http://pastebin.com/NHpLaEZ4
>>
>>52050063
[CODE] firefox http://i.4cdn.org/g/1451062609822.png[/CODE]
>>
>>52050896
>fwrite()
>not _write()
>>
>>52050063
is the triangle all wibly wobbly on purpose?
>>
>>52050063

Row r between 1 and R has (R-r) spaces followed by r dots. Do your own for-s.
>>
print ("      o", "\n    o o", "\n  o o o", "\no o o o")
Thread replies: 29
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.