*Miscue's Computer Science Thread*

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LaW
    Why play?
    • Oct 2000
    • 3124

    #16
    Always time for a refresher
    Taking a long needed leave of the sport to finish school and tour the country

    b2k3w/pds, vaporized, vapor valve, aka sidewinder, chaos chip, palmer rock lpr, CP barrels, 68/45 hyperflow

    B2k3 w/pds and bunch of upgrades for sale

    Comment

    • gimp
      Registered User
      • Jan 2001
      • 2368

      #17
      hehe, now I can skip my comp sci lecture today right?

      Comment

      • Failure
        I Love Techno
        • Nov 2001
        • 487

        #18
        Yes but what if there is a 65 degree incline jump on the offroad part of the track. Due to the ferarri's extremely low ride height it wouldn't be able to climb the jump. LOL

        Comment

        • FeelTheRT
          Registered User
          • Jun 2001
          • 2950

          #19
          I havn't really complied this so i wouldn't know if it would work or not... but pritty sure it will.

          // u learn how to program in C++ if u take computer science class.
          // stuid quick little prgram in C++
          // 4 function calculator

          #include <iostream.h>

          void add();
          void sub();
          double mult();
          double div();

          int main()
          {
          int l,choice, invalid;
          do{
          cout<<" Choose either to add(1), subtract(2), multiply(3), divide(4) or quit(5): ";
          cin>>choice;
          if(choice==1)add();
          if(choice==2)
          sub();
          if(choice==3)mult();
          if(choice==4)div();
          if(choice==5)cout<<"Wrong answer buddy! muhhahaha!! You can not leave the caluclator of DDOOOOOOOMM!!"<<endl<<endl;
          else{ cout<<"INVALID ANSWER BUDDY >=)"<< endl;
          }
          return 0;
          }

          void add()
          {
          cout<<"aww common, are you really that stupid to not knwo hwo to add?? I'm not wasting my time writing code for addition..."<<endl;
          }

          void sub()
          {
          int n1,n2;
          cout<< "fine... enter two numbers to be subtracted: ";
          cin>> n1 >> n2;
          cout<<n1<<" minus "<<n2<<" equals... "<<n1-n2<<"."<<endl;
          }

          double mult()
          {
          int n1,n2;

          cout<<" Didn't you learn your multiplication table when u were in 3rd grade?!"<<endl<< Enter two numbers you wish to be multiplied: ";
          cin>>n1>>n2;
          cout<<n1<<" times "<<n2<<" equals... "<<n1*n2<<"."<<endl;
          }

          double div()
          {
          int n1, n2;
          cout<< Plz enter two numbers you wish to be divided: ";
          cin>> n1>>n2;
          cout<<n1<<" divided by "<<n2<<" equals..." <<n1/n2<<"."<< endl;
          }


          //edit: hrm.. aparently the forums don't like C++... some of the stuff got messed up.. oh well
          Last edited by FeelTheRT; 02-14-2002, 03:53 PM.
          FS: RARE Adrenaline Angel LED #8



          ~~~ FS:ASA, angled drop ~~~
          ~~~ FS: DYE sight rail && Angel LCD bolt

          Comment

          • Miscue
            Super Moderator

            • Oct 2000
            • 7105

            #20
            You got like over a dozen things in there that will keep it from compiling... And even after you clean up your syntax errors, your program won't do anything.

            It should look more like this (I didn't check it for errors, but should be pretty close):

            #include < iostream.h>

            double ADD(double, double);
            double SUBT(double, double);
            double MULT(double, double);
            double DIV(double, double);

            int main()
            {
            &nbsp&nbspint myOperator;
            &nbsp&nbspdouble operand1, operand2;
            &nbsp&nbspint done = 0;
            &nbsp&nbspwhile (!done){
            &nbsp&nbsp&nbsp&nbspcout << "Enter operands: " << endl;
            &nbsp&nbsp&nbsp&nbspcin >> operand1 >> operand2;
            &nbsp&nbsp&nbsp&nbspcout << endl << "Choose an operator: " << endl;
            &nbsp&nbsp&nbsp&nbspcout << "1: Add" << endl;
            &nbsp&nbsp&nbsp&nbspcout << "2: Subt" << endl;
            &nbsp&nbsp&nbsp&nbspcout << "3: Mult" << endl;
            &nbsp&nbsp&nbsp&nbspcout << "4: Div" << endl;
            &nbsp&nbsp&nbsp&nbspcout << "0: EXIT" << endl;
            &nbsp&nbsp&nbsp&nbspcin >> myOperator;
            &nbsp&nbsp&nbsp&nbspif (myOperator == 1)
            &nbsp&nbsp&nbsp&nbsp&nbsp&nbspcout << operand1 << " + " << operand2 << " = " << ADD(operand1, operand2);
            &nbsp&nbsp&nbsp&nbspelse if (myOperator == 2)
            &nbsp&nbsp&nbsp&nbsp&nbsp&nbspcout << operand1 << " - " << operand2 << " = " << SUBT(operand1, operand2);
            &nbsp&nbsp&nbsp&nbspelse if (myOperator == 3)
            &nbsp&nbsp&nbsp&nbsp&nbsp&nbspcout << operand1 << " * " << operand2 << " = " << MULT(operand1, operand2);
            &nbsp&nbsp&nbsp&nbspelse if (myOperator == 4)
            &nbsp&nbsp&nbsp&nbsp&nbsp&nbspcout << operand1 << " / " << operand2 << " = " << DIV(operand1, operand2);
            &nbsp&nbsp&nbsp&nbspelse if (myOperator == 0)
            &nbsp&nbsp&nbsp&nbsp&nbsp&nbspdone = 1;
            &nbsp&nbsp} // end while

            &nbsp&nbspreturn 0; // Tells OS program completed with no errors
            }

            double ADD(double op1, double op2)
            {
            &nbsp&nbspreturn (op1 + op2);
            }

            double SUBT(double op1, double op2)
            {
            &nbsp&nbspreturn (op1 - op2);
            }

            double MULT(double op1, double op2)
            {
            &nbsp&nbspreturn (op1 * op2);
            }

            double DIV(double op1, double op2)
            {
            &nbsp&nbspreturn (op1 / op2);
            }
            Last edited by Miscue; 02-15-2002, 09:27 AM.

            Comment

            • DJSOLID
              SpinWax&TradePaint
              • Jan 2002
              • 166

              #21
              I've been following this - it's pretty interesting, but I'm not sure If I learned anything. Miscue, what was the first textbook you used when learning to program. (i.e. beginning literature/manuals)
              The gelatin on the stainless like the diamond on the vinyl.

              Comment

              • Miscue
                Super Moderator

                • Oct 2000
                • 7105

                #22
                Humm... first programming book:

                The Complete HyperCard 2.2 Handbook... followed by "Oh Pascal." Don't get these books though... pretty much dead languages.

                You can never have too many programming books... I have multiple books on the same language - simply because one book just doesn't cover or concentrate on everything.

                If you're interested in getting a C++ book, the "C++ How To Program" book from Deitel & Deitel is good. "Programming and Problem Solving with C++" by Dale-Weems-Headington is an ideal book for beginners. It seems that just about every book from O'Reilly is really good (my favorite line of books)... they do the VariousTopic-in-a-Nutshell books. "Black Books" are typically good, I particularly like the VB Black Book.

                After you become pretty familiar with C++ and programming in general, "Data Structures & Algorithm Analysis in C++" by Weiss is good. If not this one, you should get something on data structures and stuff dealing with basic algorithm analysis type stuff... Big-O, Big-Theta... etc.

                The Revolutionary Guide to Assembly Language is one of the best I've found for x86 assembly... if you get into that.

                Some good non-programming books (but a little on the intermediate/advanced side):
                "Computer Organization" by Hamacher-Vranesic-Zaky
                "Computer Organization & Design" by Patterson-Hennessey

                Yeah, the stuff I've put on here so far is kinda dry. Eventually I'll put up a link for a free C++ compiler and show you guys how to get started with it if you're curious. It's not exactly exciting either... but more immediately useful maybe.

                Or maybe some day I'll do an intro to PHP... which is kinda spiffy. Dynamic web page stuff... this message board was written in PHP actually... JavaScript is also a possibility.
                Last edited by Miscue; 02-15-2002, 11:26 PM.

                Comment

                • FeelTheRT
                  Registered User
                  • Jun 2001
                  • 2950

                  #23
                  hey Miscue, thanx for changing some of the stuff but whats with changing my intergers? Now it looks like something one of the smart kids in my CS class wrote :-b .
                  FS: RARE Adrenaline Angel LED #8



                  ~~~ FS:ASA, angled drop ~~~
                  ~~~ FS: DYE sight rail && Angel LCD bolt

                  Comment

                  • Miscue
                    Super Moderator

                    • Oct 2000
                    • 7105

                    #24
                    Oh, I thought you were using all double's... just change what you need to be different...

                    Comment

                    • Vegeta
                      Moderator? Mob Boss.
                      • Oct 2001
                      • 1050

                      #25
                      Ahhhhh binary.... thats what hte first computers were... lots of switches... then came the vaccum tube.. AH! we can do more complex switching without having to flip 1000 switches! I can add millions of numbers together in five minutes (boy it gets hot in here)... then came the transistor. Ahah! we can flip the switches electronically insted or manually! I can add millions of numbers in fractions of a second. Then came the microchip.. AHAH! We can put hundreds of theres transistors in the sice of your thumbnail! We can do Millions and millions of calculations a second!

                      Next, I see 3D microchips. insted of being flat, they will be cube-shaped and have 6 internal sides of etched boards, tied toegether by hundreds of littel copper fibers running across the gaps. WEEEEEEEEEEEE.


                      OK that was my failed attepmt at computer history.
                      -Vegeta
                      View my DevArt gallery Here

                      Comment

                      • Miscue
                        Super Moderator

                        • Oct 2000
                        • 7105

                        #26
                        Ok, some people have asked me to help them get started with programming, so let's do it!

                        But let's do it in UNIX - or at least an emulator - while we're at it. Two birds with one stone ya know.

                        If you don't have a Linux/BSD/etc. box... get the Freeware GNU Unix Emulator from Redhat here:



                        That's not the whole program though, just the installer. It grabs files off the net - this will be a sizeable download. Dial-up peoples: it's gonna take a LONG time.

                        After running setup, just leave the defaults and keep going to next until it gives you the "Select packages to install" screen. This is what you will need - don't miss anything: (click the thing that says skip until you get a check box, then check it)

                        Devel->gcc. (After you click this checkbox, also click the binutils checkbox that also becomes available)

                        Doc->man

                        Editors->nano

                        Utils->clear

                        gcc is the GNU Compiler Collection (no longer GNU C Compiler) that you can use to compile C, C++, Fortran, and some other stuff.

                        man is the program you use to display manual for commands and stuff.

                        nano is a text editor we can use for writing the programs. I personally kinda like EMacs, but it's not available for this unix emulator... among other things it seems. Oh well, it's still useful for learning purposes.

                        clear is a utility that clears the screen.

                        I'll briefly go over UNIX basics later... and then on to some actual C++ stuff.
                        Last edited by Miscue; 02-19-2002, 11:41 PM.

                        Comment

                        • LaW
                          Why play?
                          • Oct 2000
                          • 3124

                          #27
                          miscue- you have too much time on your hands... you should charge for your information (nm knowledge is free).... hehe


                          i prefer emacs....bummer hehe
                          Taking a long needed leave of the sport to finish school and tour the country

                          b2k3w/pds, vaporized, vapor valve, aka sidewinder, chaos chip, palmer rock lpr, CP barrels, 68/45 hyperflow

                          B2k3 w/pds and bunch of upgrades for sale

                          Comment

                          • Miscue
                            Super Moderator

                            • Oct 2000
                            • 7105

                            #28
                            Originally posted by LaW
                            miscue- you have too much time on your hands...
                            Some people go out drinking... gambling... partying... I'd rather write code or something. Thus is my vice.

                            I don't spend more than 15-20 minutes on these posts, and it's usually when I need a break from what I'm doing - or I'm stuck at work and have absolutely nothing to do.

                            Comment

                            • LaW
                              Why play?
                              • Oct 2000
                              • 3124

                              #29
                              Alright I got what your saying I'm kind of the same way...
                              Taking a long needed leave of the sport to finish school and tour the country

                              b2k3w/pds, vaporized, vapor valve, aka sidewinder, chaos chip, palmer rock lpr, CP barrels, 68/45 hyperflow

                              B2k3 w/pds and bunch of upgrades for sale

                              Comment

                              • FeelTheRT
                                Registered User
                                • Jun 2001
                                • 2950

                                #30
                                why do you use BSD Miscue? Are you on a server or something? Becase I really don't see what the point of any computer running BSD unless it's a server..
                                FS: RARE Adrenaline Angel LED #8



                                ~~~ FS:ASA, angled drop ~~~
                                ~~~ FS: DYE sight rail && Angel LCD bolt

                                Comment

                                Working...