Results 1 to 20 of 20

Thread: Does anyone have any good rountines?

  1. #1
    Guest

    Post

    Any, any at all?

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    to do what in particular?

  3. #3
    Guest
    Anything worth doing.

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    This one rocks, considering the current season:
    Code:
    #include <stdio.h>
    main(t,_,a)char *a;{return!0<t?t<3?main(-79,-13,a+main(-87,1-_,
    main(-86,0,a+1)+a)):1,t<_?main(t+1,_,a):3,main(-94,-27+t,a)&&t==2?_<13?
    main(2,_+1,"%s %d %d\n"):9:16:t<0?t<-72?main(_,t,
    "@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+,/#\
    ;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l \
    q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# \
    ){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' \
    iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \
    ;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;#'rdq#w! nr'/ ') }+}{rl#'{n' ')# \
    }'+}##(!!/")
    :t<-50?_==*a?putchar(31[a]):main(-65,_,a+1):main((*a=='/')+t,_,a+1)
      :0<t?main(2,2,"%s"):*a=='/'||main(0,main(-61,*a,
    "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);}
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5
    Member Benjamin's Avatar
    Join Date
    Nov 2000
    Posts
    48
    tried compiling in borland, Dev C++, and VC++ 6

    I got 5 errors with Dev C++ and VC++ and 12 with borland

    -Dennis
    [email protected]
    Ever stop to think, and forget to start again?


    The end justifies the means
    http://www.cfm-resources.com/d/dewrenn
    http://www.phpsquare.com

  6. #6
    Member Benjamin's Avatar
    Join Date
    Nov 2000
    Posts
    48
    Ok, I compiled as a C project in Dev C++ and it worked, but the console closed so fast I couldn't read it...


    BTW Chimp:
    I have a few math routines I have that you may like?


    Distance Formula
    Factorial
    and random numbers

    I also have a routine that draws a line out of any character...
    and any length, and any position on the console window


    let me know,

    Dennis
    -Dennis
    [email protected]
    Ever stop to think, and forget to start again?


    The end justifies the means
    http://www.cfm-resources.com/d/dewrenn
    http://www.phpsquare.com

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Dennis - run the program in a console window, then you'll see.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  8. #8
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Any idea how to get it to compile in VC++ 6?
    Harry.

    "From one thing, know ten thousand things."

  9. #9
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Make sure it's in a file with a .c extension, not .cpp - then it'll work.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  10. #10
    Guest
    Benjiman, sure, i try em!

  11. #11
    Guest
    You gonna post em?

  12. #12
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    I am wondering how does parksie's routine work. All i see are some weird signns.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  13. #13
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Hey cool The code looks like complete gibberish though. Almost as bad as Befunge.
    Harry.

    "From one thing, know ten thousand things."

  14. #14
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    It seems like it's recursively calling main(). I'll have a go at 'decoding the code'...as it were

    I may be gone some time
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  15. #15
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    it looks like the code is mainly taken up by strings

    Code:
    #include <stdio.h>
    main(t,_,a)char *a;
    {
    	return !0 <t?t<3? main(-79,-13,a+main(-87,1-_,
    main(-86,0,a+1)+a)):1,t<_?main(t+1,_,a):3,main(-94,-27+t,a)&&t==2?_<13?
    main(2,_+1,"%s %d %d\n"):9:16:t<0?t<-72?main(_,t,
    
    
    //a big string
    "@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+,/#\
    ;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l \
    q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# \
    ){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' \
    iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \
    ;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;#'rdq#w! nr'/ ') }+}{rl#'{n' ')# \
    }'+}##(!!/"
    
    )
    
    
    :t<-50?_==*a?putchar(31[a]):main(-65,_,a+1):main((*a=='/')+t,_,a+1)
      :0<t?main(2,2,"%s"):*a=='/'||main(0,main(-61,*a,
    
    //a smaller string
    "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"
    
    
    ),a+1);
    I would guess that the big string is an encrypted form of the verses, and its decrypted by the code.

  16. #16
    Member Benjamin's Avatar
    Join Date
    Nov 2000
    Posts
    48
    sorry it took so long, I forgot all about this thread!

    these aren't really functions, they are whole programs, but can be easily modified and put into a function
    compliment and suppliment:

    Code:
    /*
    Copyright © 2000 Dennis Wrenn
    Please do not steal this code and
    claim it as your own, if you have to
    do that, you must be one pathetic fool.
    
    [email protected]
    
    Code written in notepad,
    compiled in Borland Turbo C++ 4.5
    */
    
    #include <iostream.h>
    
    int main()
    {
    int choice;
    int angle;
    int comp, sup;
    do
    {
    cout << "Find the compliment(1), or the supplement(2)?: ";
    cin >> choice;
    }while(choice < 1 || choice > 2);
    
    cout << "Please enter the angle: ";
    cin >> angle;
    
    comp = 90 - angle;
    sup = 180 - angle;
    
    switch (choice)
    {
    case 2:
    cout << "The Suppliment of " << angle << " is " << sup;
    break;
    
    case 1:
    cout << "The Compliment of " << angle << " is " << comp;
    break;
    }
    return 0;
    }
    distance:
    Code:
    /*
    Copyright © 2000 Dennis Wrenn
    Please do not steal this code and
    claim it as your own, if you have to
    do that, you must be one pathetic fool.
    
    [email protected]
    
    Code written in notepad,
    compiled in Borland Turbo C++ 4.5
    */
    
    #include <iostream.h>
    #include <math.h>
    
    int main(void)
    {
    
    cout.setf(ios::fixed);
    double x1;
    double y1;
    double x2;
    double y2;
    double d;
    
    cout.precision(2);
    
    //X1
    cout << "Please enter the coordinate point for X1: ";
    cin >> x1;
    
    //Y1
    cout << "Please enter the coordinate point for Y1: ";
    cin >> y1;
    
    //X2
    cout << "Please enter the coordinate point for X2: ";
    cin >> x2;
    
    //Y2
    cout << "Please enter the coordinate point for Y2: ";
    cin >> y2;
    
    /*
    distance formula =
      ____________________________
    |/ (X2 - X1)^2 + (Y2 - Y1) ^ 2
    
    */
    
    d = sqrt( (pow((x2 - x1),2)) + (pow((y2 - y1),2)) );
    
    cout << "The Distance between the points you entered are: ";
    cout << d;
    
    return(0);
    }
    factorial:
    Code:
    /*
    Copyright © 2000 Dennis Wrenn
    Please do not steal this code and
    claim it as your own, if you have to
    do that, you must be one pathetic fool.
    
    [email protected]
    
    Code written in notepad,
    compiled in Borland Turbo C++ 4.5
    */
    
    #include <iostream.h>
    
    int main()
    {
    	int number = 0; //the number to be fractaled
    	int count = 0;  //counter variable
    	double fractal = 1; //The end number needs to have large available
    										//memory incase
    										//somebody enters a large number
    
    	do
    	{
    		cout << "Please enter a number greater than 0 and \n"
    		<< "less than 170: ";     //input
    		cin >> number;         //idiot proof loop, don't want a negative number
    		cout << endl;          // entered
    		//if the number is >170 then there will be an overflow
    	} while (number <= 0 || number >=171);
    
    	for(count = 1; count <= number; count++)
    	{
    		cout << fractal << " * " << count;      //main processing loop
    		fractal *= (double)count;
    		cout << " = " << fractal << endl;
    	}
    
    	cout << endl;
    
    	cout << number << "!" << " = " << fractal;               //output
    
    	return 0; //return nothing to indicate 0 errors occured
    }
    Code:
    #include <random.h>
    #include <iostream.h>
    
    int main()
    {
    randomize();
    int r = random(100); // generates #'s between 0 - 99
    r++; // we want 1 - 100
    cout << r << endl;
    return 0;
    }
    the last one isn't much... just a little thing I threw together...

    [Edited by Benjamin on 12-03-2000 at 02:27 PM]
    -Dennis
    [email protected]
    Ever stop to think, and forget to start again?


    The end justifies the means
    http://www.cfm-resources.com/d/dewrenn
    http://www.phpsquare.com

  17. #17
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    compliment and suppliment
    Complement and Supplement
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  18. #18
    Member Benjamin's Avatar
    Join Date
    Nov 2000
    Posts
    48
    -Dennis
    [email protected]
    Ever stop to think, and forget to start again?


    The end justifies the means
    http://www.cfm-resources.com/d/dewrenn
    http://www.phpsquare.com

  19. #19
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Yes, I picked the code apart too a while ago. The bit I didn't understand was this:
    Code:
    main(t,_,a)char *a;
    I thought C was strongly typed - what are t, _ and a? And what's "char *a" got to do with it?
    Harry.

    "From one thing, know ten thousand things."

  20. #20
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    That's the old-style formal definition:
    Code:
    void main(argc, argv)
    int argc;
    char **argv;
    {
        // ...
    }
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width