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

Fucking C

Name: Anonymous 2012-11-03 14:43

Why it doesn't show me strings like "  a"?
Why is the while loop in the trim function bugged (if I input 2 chars the next input length can't be less than 2)?

#include <stdio.h>

#define MAX 1001

int getLine(char s[], int length){ // returns 1 or 0

    int i, qttWord = 0; //qttWord = counter of letters for s[]
    int c; // c = getchar()

    /*Reads the input and puts it into s[], then, verifies if the input is just \n,
    * if so, returns 0(i), if not, puts '\0' at the end of the string.
    */
    for (i = 0; i < length-1 && (c = getchar()) != EOF && c != '\n'; ++i){
            s[i] = c;
            ++qttWord;

    }
    if (i == 0){
        return 0;
    } else if (c == '\n'){
        ++i;
        s[i] = '\0';

    }
    /*Verifies if the string is just ' ' or '\t'
    * if so, returns 0
    */
    char flag = '\0';
    for (i = 0; i < qttWord && flag != '1'; ++i){
        if (s[i] == ' ' || s[i] == '\t'){
            flag = '0';
        } else{
            flag = '1';
        }
    }
    if (flag == '0')
        return 0;

    return qttWord;
}
void trim(char s[], int length){

    char s2[MAX];
    int i, qttWord = 0;

    /*while (s[length] != '\0'){
        ++length;
    }
    printf("length:%d\n", length);*/
    for (i = 0; i < length; ++i){
        if (i < length-1){
            if (s[i] == ' ' && s[i+1] != ' '){
                s2[i] = s[i];
                ++qttWord;
                printf("1:%d\n", s2[i]);// if true prints "1" and the character(' ')
            }
        }
        if (s[i] != ' '){
            s2[i] = s[i];
            ++qttWord;
            printf("0:%d\n", s2[i]);//if true prints "0" and the character
        }
    }
    s[0] = '\0';
    s2[qttWord] = '\0';

    for (i = 0; i < qttWord; ++i){
        s[i] = s2[i];
    }
    s2[0] = '\0';
}

int main(){
    char line[MAX];
    int lgh = 0;

    while ((lgh = getLine(line, MAX)) != 0){
        trim(line, lgh);
        printf("%s\n", line);
        line[0] = '\0';
        lgh = 0;
    }
    return 0;
}

Name: Anonymous 2012-11-05 0:09

>>79
define "limit"

Name: Anonymous 2012-11-05 0:15

>>83
Let (X, d) be a metric space and {a_n} a sequence of points in X.
The limit of {a_n} as n tends to +\infty is A if
\forall \varepsilon > 0 \exists N \geq 0 : \forall m \geq N d(a_m, A) < \varepsilon

Name: Anonymous 2012-11-05 0:22

>>83

#define limit

Name: Anonymous 2012-11-05 0:31

>>84
define "metric space"
define "point"
define "+\infty"

Name: Anonymous 2012-11-05 1:57

>>86

A metric space is a pair (X, d), where X is a set, and d is a function defined as follows:

d: X * X -> R+

That is, d maps pairs of elements of X to the non negative real numbers. If a and b are elements of X, d(a,b) = r is interpreted as the distance between a and b.

d must satisfy the following properties:

\forall a \in X, d(a,a) = 0.  The distance from a point to itself is zero.

\forall a,b \in X, d(a,b) = d(b,a)  It doesn't matter from which end you measure the distance from.

And d must satisfy the triangle inequality:

\forall a,b,c \in X, d(a,b) + d(b,c) >= d(a,c)

A point is an element of X.

+\infty as seen in >>84 is nothing more than a symbol.

Name: Anonymous 2012-11-05 2:14

The only accumulation point of the natural numbers w.r.t. the euclidean metric

Name: Anonymous 2012-11-05 2:17

>>88
you are making us look bad in front of the finitist.

Name: Anonymous 2012-11-05 3:43

>>87
define "set"
define "R+"
define "function"
define "element of"

Name: Anonymous 2012-11-05 4:06

>>90
A set is a collection of objects. If X is a set and y is an object, the statement y is an element of X is either true or false.

R+ is the set of non negative real numbers. { r in R | r >= 0 }

A function is a mapping from a domain set to a range set. For each element in the domain, there is a unique corresponding value in the range set. Rigorous definition following...

If X and Y are sets, then X is said to be a subset of Y if for every considerable object o, o must be element of Y whenever o is an element of X.
o in X implies o in Y.
\forall o \in X, o \in Y


If X and Y are sets, the cartesian product of X and Y, denoted as X*Y, is the set of all pairs (x,y) such that x is an element of X and y is an element of Y.
X*Y = { (x,y) | x \in X, y \in Y }

A relation R between X and Y is a subset of the cartesian product of X and Y. If a pair (x,y) is an element of R, x and y are said to be related, or related by R.

A function f: X -> Y is a relation of X and Y such that each element of X is related by f to a unique element of Y.

\forall x \in X, \exists ! y \in Y, (x,y) \in f

The statement (x,y) \in f is written as f(x) = y.

Name: Anonymous 2012-11-05 4:16

>>91
define "collection of objects"
define "real numbers"
define "true"
define "false"

Name: Anonymous 2012-11-05 5:04

>>92

I'll avoid defining collection of objects by redefining set and element of. I'm also throwing out objects.

If X and Y are sets, the proposition X is an element of Y is a statement that is either true or false.

A proposition is a statement that is either true or false. A proposition that is true cannot be false. A proposition that is false cannot be true. A proposition cannot be neither true nor false. A proposition cannot be both true and false.

The set of real numbers can be defined as the set of all equivalence classes of Cauchy sequences of rational numbers.

This is going to take a while.

PART 1:

A relation R on a set X is a relation from the set to itself. That is R is a subset of X*X.

A relation R on a set X is called reflexive if each element of X is related to itself.
\forall x \in X, (x,x) \in R

A relation R on a set X is called symmetric if for each x,y in X, if x is related to y whenever y is related to x.
\forall x,y \in X, (x,y) \in R -> (y,x) \in R

A relation R on a set X is called transitive if for each x,y,z in X, x is related to z whenever x is related to y and y is related to z.
\forall x,y,z \in R, ((x,y) \in R and (y,z) \in R) -> (x,z) \in R

A relation R on a set X is called an equivalence relation if R is transitive, symmetric, and transitive.

If X is a set and Y is the empty set, the proposition X is an element of Y is always false.

If X is a set, Y is a set, W is a set, and Z is the intersection of X and Y, then W is an element of Z only when W is an element of X and W is an element of Y.
(W \in X and W \in Y) <-> W \in Z

If X is a set, Y is a set, W is a set, and Z is the union of X and Y, then W is an element of Z only when W is either an element of X or W is an element of Y.
(W \in X or W \in Y) <-> W \in Z

If X is a set and Y is a set, X is equal to Y if and only if X is a subset of Y and Y is a subset of X.

If X is a set, P is a partition of X if P is a set of subset of X such that the following are satisfied:

If A is a set, B is a set, and A is an element of P and B is an element of P, then the intersection of A and B is equal to the empty set.

The union of all elements of P is equal to X.


If R is an equivalence relation on a set X, a maximal subset of X in which all elements are mutually related to one another is called an equivalence class of X.

Provable result: The set of all equivalence classes of X forms a partition of X.

Zero is the empty set.

If X is a set, then Y is the successor of X if Y is the smallest super set of X such that X is an element of Y.

If Y is a set, then X is the predecessor of Y if Y is the successor of X.

If X is a set, X is called a natural number if it is zero or if it is the successor of a natural number.

If X, Y, Z are natural numbers, Z is the sum of X and Y if any of the following are satisfied:

Z is equal to X and Y is equal to zero.
Z is equal to Y and X is equal to zero.
Z is the sum of the successor of X and the predecessor of Y.

If X, Y, Z are natural numbers, Z is the subtraction of X and Y if any of the following are satisfied:

Z is equal to X and Y is equal to zero.
Z is the subtraction of the predecessor of X and the predecessor of Y.

one is the successor of zero.

If X, Y, Z are natural numbers, Z is the multiplication of X and Y if any of the following are satisfied:

Z is equal to zero and X is equal to zero
Z is equal to zero and Y is equal to zero
Z is equal to X and Y is equal to the one.
Z is equal to Y and X is equal to the one.
Z is the sum of X and the multiplication of the X and the predecessor of Y.


If X, Y, Z are natural numbers, Z is the division of X and Y if X is the multiplication of Z and Y.

If X, Y are natural numbers, X is greater than or equal to Y if there is a natural number Z such that X is the sum of Y and Z.

If X, Y are natural numbers, X is called a divisor of Y is there exists a natural number Z such that Z is the division of Y and X.

If X, Y, Z are natural numbers, Z is called the greatest common divisor of X and Y if Z is a divisor of X, Z is a divisor of Y, and if W is a natural number such that W is a divisor of X and W is a divisor of Y, then Z must be greater than or equal to W.

A rational number is a pair of natural numbers whose greatest common divisor is one.

to be continued...

Name: Anonymous 2012-11-05 5:22

>>93
define "all"
define "equivalence classes"
define "Cauchy"
define "sequences"

I'll avoid defining collection of objects by redefining set and element of. I'm also throwing out objects.
Shalom! Avoiding answering directly is a typical Jewish quality.

Name: Anonymous 2012-11-05 5:23

>>94
Imbecilic racist cretin.

Name: Anonymous 2012-11-05 5:25

I stoped at:
MSVC 6:

+ MS th

Name: Anonymous 2012-11-05 5:25

>>95
Shalom!

Name: Anonymous 2012-11-05 5:42

If you try to curtail my essential rights or link videos that require a proprietary binary blob to be played, I will shoot you with my riot gun.

Also, die in a fire, illogical cretin.

Name: Anonymous 2012-11-05 5:43

Name: Anonymous 2012-11-05 5:51

>>99
Die in a fire, illogical shithead. I have inalienable rights to cryptography and free software. My ThinkPad is free of proprietary binary blobs and my gun is loaded.

Name: Lambda A. Calculus 2012-11-05 5:51

2: Fucking C (99)
DA STANDARD

Name: Anonymous 2012-11-05 5:52

>>98,100
stop mocking me you cock sucking cretin

Name: Anonymous 2012-11-05 6:06

>>102
You don't try to curtail MY ESSENTIAL FUCKING RIGHTS, illogical cocksucker because I HAVE A FUCKING RIGHT TO HAVE ESSENTIAL RIGHTS including but not limited to: cryptography, free software, free speech and my essential right to be a self-righteous preaching and spamming faggot.
You will be shot.
Same thing applies if I find you anywhere near my .emacs, my rabbits, my Lemoteor my PGP key.
Die in a fire or I'll shoot you with my gun cretin.

Name: Anonymous 2012-11-05 6:15

>>103
Are you arguing against those rights, cretin?  We already know that you have a problem with the mere existence of racist/sexist/homophobic humour (even if done sarcastically), which makes you Nazi freedom-of-speech-hating cretin, let's see which of those rights you'll argue against next.  Perhaps you'll tell me that your lovely ideal Electronic Police State should be allowed to lawfully access the contents of any computer without a warrant at any time, and that cryptography is evil and should be banned because some terrorist/paedophile/serial-murderer/homophobic-joke-utterer was caught using it at some point.  Or maybe animal agriculture should be banned entirely because humans are too righteous and moral to do such a lowly animalistic thing as eating meat.  Who knows what retarded thing you'll argue against next.

Name: Anonymous 2012-11-05 6:25

>>103
Are you arguing against those rights, cretin?
I'm not.
Strong faggotic personae are worse than tripcodes. You're pushing it too much. It has to be regurgitated at one point. But you're too dense to understand. Faggot.

(...) rest of your post
I'm not that person, I barely speak to you, faggot.

Name: Anonymous 2012-11-05 7:01

And then >>104 was the cretin.
Your existence is really starting to grate. Your straw men don't cover up the fact that you just want things because you feel entitled to them.

Name: Anonymous 2012-11-05 7:11

>>106
No, it's because I am entitled to them and I will fight for them if need be.  Fuck off and die you fucking cretin.

Name: Anonymous 2012-11-05 7:16

>>107
You've reached an all-time high, cretin. The pinnacle of rationality and righteousness.

Name: Anonymous 2012-11-05 7:31

>>108
Really?  Then tell me, my cretinoid ``friend'', where do all these rights originate from?  Surely the UDHR wasn't handed down from God himself.

Name: Anonymous 2012-11-05 7:34

>>105
I shall not be silenced.

Name: Anonymous 2012-11-05 7:36

I killed a Jew. It felt pretty good. Highly recommended.

Name: Anonymous 2012-11-05 7:37

>>111
what a waste of triples

Name: Anonymous 2012-11-05 7:39

>>109
himself
Get out.

Name: Anonymous 2012-11-05 7:39

btw >>108 thanks for making me invest so much time in this persona, I'll never go away now

Name: Anonymous 2012-11-05 7:41

>>114
Goddammit Nathan Poe now I'm confused

Name: Anonymous 2012-11-05 8:50

>>113
Sorry, I forgot to capitalize the pronoun.

Name: Anonymous 2012-11-05 8:57

>>115
I, feminazi and the Jew guy now form the triangle of hate.

Name: Anonymous 2012-11-05 9:01

>>117
Enjoy being an idiot.

Name: Anonymous 2012-11-05 9:09

>>118
Enjoy being a freedom-hating retard.

Name: Second form Feminazi 2012-11-05 9:11

>>117
Yes, yes! We need more allies in our wicked crusade to oppress the 13-years old Libertarians of the world, crushing their freeze peaches under our heel, discriminating them by telling them on their use of slurs.

Name: Anonymous 2012-11-05 9:14

>>120
13-years old
Fuck off and die, cretin.

by telling them on their use of slurs.
Fuck off, nigger faggot cretin.

Name: Anonymous 2012-11-05 9:20

>>120
ONCE AGAIN< FUCK OFF AND DIE YOU FREEDOM HATING PIECE OF SHIT

Second of all, this all started when you borked out the retarded statement that any pejorative usage of the word faggot is evil and harmful to society in any possible context, which is fucking false.  If you plug your ears and go LALALA when presented with a corner case, then you are not cut out to be a programmer.

Name: Anonymous 2012-11-05 9:41

>>122
Look, buddy, you ``ironic'' use of the word I can bet that ain't, because in the end, what makes it funny and edgy is that poking at the insecurities of your friends with the outrageous notion that they are gay is what they most likely find humorous. The fact that you use it pejoratively is damning in its own way, besides, and an argument on itself, closet homophobe

I know this because that's been the case with all of my good ol' pals which do that. And the hundreds of grown-up versions of you on the Internet.

And now you are using it in an attempt to rail me off. So much for your ``feminism''.

I haven't responded to you on that because the threads have either threadstopped or I have stated that I'm bailing out because I don't have that much time to deal with self-deluded little assholes like you.

And you still don't understand what free speech entails.

Fuck off, and come back when you are further into puberty, ``please''.

Name: >>123 2012-11-05 9:44

>>122
And this ``started'' because you can't quit an argument on the Internet, so what else can we do but milk you for all your nerdrage?

Name: Anonymous 2012-11-05 9:47

>>123
Fuck off and die freedom hating faggot nigger. My rights are the most sacred thing on earth and I will kill you with my gun to defend them.

Name: >>123 2012-11-05 9:49

Look, buddy, you ``ironic'' use of the word I can bet that ain't,

Shit, I really fucked up that sentence. Oh, well. Back to work it is.

Name: Anonymous 2012-11-05 9:54

>>126
Back to work
You will never curtail my rights. Die in a fire cretin.

Name: Anonymous 2012-11-05 10:14

>>124
EAT SHIT AND DIE CRETIN.

>>123
The fact that you use it pejoratively is damning in its own way, besides, and an argument on itself, closet homophobe.
Conclusion does not follow from premises.  Prove to me that such behaviour actually hurts homosexuals.

And the hundreds of grown-up versions of you on the Internet.
FUCK OFF AND DIE.

And you still don't understand what free speech entails.
It entails that anyone may be criticized by anyone else, and that anyone may say discriminatory jokes to their heart's content.

Fuck off, and come back when you are further into puberty, ``please''.
FUCK OFF AND DIE YOU COCK SUCKING CRETIN I FUCKING HATE YOU.

Name: Anonymous 2012-11-05 10:56

>>128
And we are criticising you for being a crappy kid due to making homophobic jokes.

It's harmful in public and semi-public settings, like these. Sure, segregated from society it's arguably harmless. That you still think that it's an insult tells me that you are a hypocrite.

And you should really get off your computer now, son. Why must you suffer so much anger over being corrected on a forum.

I'm out for a while, I've got stuff to do.

Name: Feminazi Stormtrooper 2012-11-05 11:13

>>129
Correction: it's not that you think that it's an insult (it is), it's that you use it as such.

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