Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Most C programmers are faggots

Name: Anonymous 2012-01-29 19:36

I'm getting really irritated at a lot of self proclaimed C programmers for abusing the fuck out structures and pointers. It's easy to get out of hand and make your code look like shit and it seems people want to do it even when it's not necessary. The problem is even a lot of legitimately experienced C programmers do the same shit. Go look at the source to your favorite software written in C.

A good example is that stupid dubs checker thread that faggot just made. It should be written like this


#include <stdio.h>

#define base 10

int check(int i, int b) {
  return(i%b == (i/b)%b);
}

int main(void) {
  int i = 1;
 
  while(i++ < 100)
    if(check(i, base))
      puts("nice dubs bro");
     
  return(0);
}

Name: Anonymous 2012-01-31 23:50


efinition 1.1:

  An integer n, is said to have dubz in base b, if and only if the following is satisfied:

                          n mod b = floor(n/b) mod b

Theorem 1.1:

  Let n be an integer, b be a base, and let r = n mod b. Then n has dubz in base b if and only if:

                          n mod b^2 = r(b + 1)

Proof:
 Part 1:
  First assume that n has dubz in base b, with r = n mod b. We will show that n mod b^2 = r(b + 1)

  Decompose n into its quotient and remainder, q and r:

                          n = qb + r

  We have that floor(n/b) = q. Because n has dubz in b, we have the following:

                          n mod b = floor(n/b) mod b
                          n mod b = q mod b

  So q will have remainder r when divided by b. Let p be the quotient of q and r.

                          q = pb + r
                          n = qb + r    q = pb + r
                          n = (pb + r)b + r
                          n = pb^2 + rb + r
                          n = pb^2 + r(b + 1)
                          n mod b^2 = r(b + 1)

  And we have arrived at the needed conclusion.

 Part 2:
  Now suppose that n satisfies:

                          n mod b^2 = r(b + 1)

  where r = n mod b. We would like to show that n has dubz in base b. The steps are essentially
  the same as Part 1 in reverse:

                          n mod b^2 = r(b + 1)

  Let p be the quotient of n and b^2. We can express n in terms of its quotient and remainder with b^2.

                          n = pb^2 + r(b + 1)
                          n = pb^2 + rb + r
                          n = (pb + r)b + r

  We have now decomposed n into its remainder and quotient of b, and found the quotient to be q = pb + r.
  But q has remainder r when divided by b, the same remainder that n has when divided by b.

                          n = qb + r    q = pb + r
                          n mod b = q mod b
                          n mod b = floor(n/b) mod b

  Thus, we have shown that n mod b yields the same remainder as floor(n/b) mod b. Therefore n has dubz in base b.

Theorem 1.2:

  to be written by >>132 san.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List