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

:3

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 36
Thread images: 15

File: cute-anime-girl.jpg (2MB, 1600x1200px) Image search: [Google]
cute-anime-girl.jpg
2MB, 1600x1200px
I-is my code good enough anon?

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

/*Here starts the code :3*/

bool is_sorted(int *a, int n) /* Checks if the list is sorted ^_^ */
{
while ( --n >= 1 ) {
if ( a[n] < a[n-1] ) return false;
}
return true;
}

void shuffle(int *a, int n) /*Shuffles the list because it's fun :-D*/
{
int i, t, r;
for(i=0; i < n; i++) {
t = a[i];
r = rand() % n;
a[i] = a[r];
a[r] = t;
}
}

void sort(int *a, int n) /*<---This is the sorting function you'll know because it is named "sort" *_* */
{
while ( !is_sorted(a, n) ) shuffle(a, n);
}

int main() /*Main program where the fun starts!! :DDD*/
{
int numbers[] = { 1, 10, 9, 7, 3, 0 };
int i;
sort(numbers, 6);
for (i=0; i < 6; i++) printf("%d ", numbers[i]);
printf("\n");
}

/*Here ends the code :3 Remember to check my last github commit about changing master/slave definitions */
>>
File: 1502135172639.jpg (90KB, 957x621px) Image search: [Google]
1502135172639.jpg
90KB, 957x621px
dumb 2d poster
>>
>>62088941
But why? Pepe-kun? Did I do something wrong?
>>
Didn't even bother to read after seeing the shitty >Look at me I put emotes in my comments
comments.
>>
>>62088991
Shit
>>
File: vomit.jpg (82KB, 680x680px) Image search: [Google]
vomit.jpg
82KB, 680x680px
>>62088915
>line over 100 characters long
>>
>>62088991
I thought it was cool :_(
>>
>>62088915
Needs more anime
>>
>linear minimal runtime
I would say that code is optimal
>>
File: Happy Akari.jpg (316KB, 732x1259px) Image search: [Google]
Happy Akari.jpg
316KB, 732x1259px
>>62088915
....yeah, remove emoticons pls.
>>
>>62088915
Not my style but ok.
The NP algorithm for sorting is crazy though.
>>
>>62088915
Cute anime girls wouldn't care about the master/slave definitions. Only SJWs care about that.
>>
nice koding op
>>
File: Good job.gif (406KB, 498x280px) Image search: [Google]
Good job.gif
406KB, 498x280px
I think op did a good job keep up the good work
>>
File: 1496344688569.png (433KB, 1024x576px) Image search: [Google]
1496344688569.png
433KB, 1024x576px
>>62088915
cute code!
>>
File: c_anime.png (544KB, 960x720px) Image search: [Google]
c_anime.png
544KB, 960x720px
is this the anime code thread?
>>
File: 1482546543791.png (65KB, 435x551px) Image search: [Google]
1482546543791.png
65KB, 435x551px
Gotta love exponential time algorithms. It's been stuck on length 15 for quite a while.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define ARRAYSZ 256

/*Here starts the code :3*/

bool is_sorted(int *a, int n) /* Checks if the list is sorted ^_^ */
{
while ( --n >= 1 ) {
if ( a[n] < a[n-1] ) return false;
}
return true;
}

void shuffle(int *a, int n) /*Shuffles the list because it's fun :-D*/
{
int i, t, r;
for(i=0; i < n; i++) {
t = a[i];
r = rand() % n;
a[i] = a[r];
a[r] = t;
}
}

void sort(int *a, int n) /*<---This is the sorting function you'll know because it is named "sort" *_* */
{
while ( !is_sorted(a, n) ) shuffle(a, n);
}

int main(int argc, char **argv) /*Main program where the fun starts!! :DDD*/
{
unsigned int n;
int i;

if (argc > 1 && (n = atoi(argv[1])));
else n = ARRAYSZ;

int numbers[n];

for (i = 0; i < n; ++i) {
numbers[i] = rand();
// printf("%d ", numbers[i]);
}

// putchar('\n');

sort(numbers, n);

for (i=0; i < n; i++) printf("%d ", numbers[i]);
putchar('\n');

return 0;
}

/*Here ends the code :3 Remember to check my last github commit about changing master/slave definitions */
>>
>>62092115
It's super exponential. Bogosort has an average runtime complexity of n!, and n! grows faster than any exponential.
>>
>>62091700
It's some sort of BASIC, definitely not C
>>
File: 1502310369960.gif (66KB, 350x350px) Image search: [Google]
1502310369960.gif
66KB, 350x350px
I want a cute coder bf already
>>
>>62094560
How can I contact you? GNU/Social?
>>
>>62088915
So basically, you made a shitty bogosort program.
>>
>>62088941
dumb frog poster
>>
>>62089030
you overdid it (a lot)>>62089030
>>
w-what does /g/-chan t-think of my code onegai
33o<CR>Fizz<CR><Esc>qqABuzz<Esc>5kq19@q:%s/^$/\=line('.')<CR>
>>
>>62088941
pepe is 2d baka
>>
>>62095515
kawaii! demo... yoku wakaranai
>>
File: domo.png (852KB, 960x540px) Image search: [Google]
domo.png
852KB, 960x540px
>>62095658
a-arigato
Vim fizzbuzz regex desu
>>
>>62095719
regex janai yo
macro dayo
>>
It's not good until you put on knee socks and sit on my lap anon chan.
>>
File: 1406730906769.jpg (137KB, 800x795px) Image search: [Google]
1406730906769.jpg
137KB, 800x795px
>>62095986
Will you pet me if I do a good job?
>>
>>62096018
I'll give you a lollipop.
>>
File: 1479403234389.jpg (29KB, 495x700px) Image search: [Google]
1479403234389.jpg
29KB, 495x700px
>>62088915
Cute code
>>
>>62096054
I love sweets!
>>
>>62096083
Thats good, I have enough to give you a stomach full.
>>
>>62088915
Klossy/10, remove yourself from the genepool
Thread posts: 36
Thread images: 15


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.