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-04 21:11

every sequence can be interpreted as a series

Name: Anonymous 2012-11-05 0:05

>>50
Why did you bother terminating s2 in trim

What's the FUQIN point

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.

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