Page 7 of 9 FirstFirst ... 56789 LastLast
Results 61 to 70 of 85

Thread: Should we have a small programming challenge?

  1. #61

    Re: Should we have a small programming challenge?

    I was just going to suggest that we have weekly programming challenges. It would definately help newbie programmers to learn differant langauges.

    jcrowe

  2. #62

    Re: Should we have a small programming challenge?

    Weekly may be a little too often. People would get burned out on it after a while. I would say every two weeks so people have a little break between programs. I wouldn't mind if the next challenge was bumped up though.

  3. #63

    Re: Should we have a small programming challenge?

    Any ideas on what the challenge could be?

    jcrowe

  4. #64

    Re: Should we have a small programming challenge?

    If I could get java working on my linux partition, I'd definately do this in java. I don't know much java, and these kinds of things are perfect to learn. Of course, since I don't have internet on my box, it's taking a while to get java fixed.
    The things kenshi was doing with assembler sound cool. Maybe if I get some time on my workterm in the summer I'll pick up some assembler.

  5. #65

    Re: Should we have a small programming challenge?

    Not (at all) optimal, but works.

    File: factors.java

    Code:
    import java.io.*;
    
    public class factors {
       
       public factors() {
       }
    
       public static void main(String args[]) {
       
          long to_factorize, number_of_factors = 0, sq_root;
       
          if (args.length!=1) {
             System.out.println("Give me ONE number, please. Thanks. ");
             System.exit(0);   
          }
          
          try {
             to_factorize = Long.parseLong(args[0]);
             if (to_factorize <= 0) {
                System.out.println("I'm veeery patient. ");
                System.exit(0);
             }
             
             sq_root = Math.round(Math.sqrt((double)to_factorize))+1;
             
             for (long i=1; i<sq_root; i++) {
                if (to_factorize%i==0) {
                   System.out.println(i + " " + to_factorize/i);
                   number_of_factors++;
                }
             }
             
             System.out.println("Number of factors: " + number_of_factors);
             
          }
          catch (NumberFormatException E) {
             System.out.println("Give me one VALID number, please. ");
             System.exit(0);
          }
       }
    }
    For the HDL solution you'll need to wait till I've WAY more free time.

  6. #66

    Re: Should we have a small programming challenge?

    Code:
    import java.io.*;
    
    public class factors {
       
       public factors() {
       }
    
       public static void main(String args[]) {
       
          long to_factorize, number_of_factors = 0, sq_root;
       
          if (args.length!=1) {
             System.out.println("Give me ONE number, please. Thanks. ");
             System.exit(0);   
          }
          
          try {
             to_factorize = Long.parseLong(args[0]);
             if (to_factorize <= 0) {
                System.out.println("I'm veeery patient. ");
                System.exit(0);
             }
             
             sq_root = Math.round(Math.sqrt((double)to_factorize))+1;
             
             for (long i=1; i<sq_root; i++) {
                if (to_factorize%i==0) {
                   System.out.println(i + " " + to_factorize/i);
                   number_of_factors++;
                }
             }
             
             System.out.println("Number of factors: " + number_of_factors);
             
          }
          catch (NumberFormatException E) {
             System.out.println("Give me one VALID number, please. ");
             System.exit(0);
          }
       }
    }
    No offense but I hate computer programs that are polite. I can't stand it when my computer says please and thank you. Well thank you isn't so bad but please is. I can just picture Dos saying, "Please don't format your drive unless you really want to lose all your data." It didn't really say that but follow with me here. If I had programmed it, it would say, "Don't type Y here unless you know what you're about to mess up." And these signs in restaurants that say, "Thank you for not smoking," how do they know you didn't smoke anyway? If I had a restaurant, the signs would say, "No smoking in here maggot." As you can tell, I'm not much of a people person. But I'm tired of all this extra politeness. When it comes to computer programs, it needs to tell a user what to do and if the user doesn't do it, then the user can deal with it when things screw up. The computer shouldn't have to beg the user to insert the next disc. I guess I'm gonna wrap it up with that.

  7. #67

    Re: Should we have a small programming challenge?

    And the award for being fussy about computer programs goes to :

    <a big pause as the audience holds thier breath>

    Kenshi!!

  8. #68
    Guest

    Re: Should we have a small programming challenge?

    Code:
    #!/usr/bin/env ruby
    
    print "What is your name? "
    name = gets.chomp
    
    if name.lowcase == "kenshi" then
      puts "You stinkin' piece of junk! Yo got an ugly name! J00 4r3 n07 t3h l33t!!!"
    else
      puts "Hi #{name}"
    end
    ;D

  9. #69

    Re: Should we have a small programming challenge?

    Hey. Don't diss on the name Kenshi. That's a cool name. Or is this your way of saying you prefered prince_kenshi?

  10. #70
    Guest

    Re: Should we have a small programming challenge?

    No, keep kenshi (I almost typed kenshin there ). Prince anything sounds too...pretty boy. Well whatever floats your boat!

Similar Threads

  1. The Python Challenge
    By AljoshaNL in forum Linux - Software, Applications & Programming
    Replies: 2
    Last Post: 02-17-2006, 07:15 PM
  2. A Challenge for the GUI gifted
    By in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 01-02-2004, 08:23 AM
  3. I need a small programming task
    By in forum Programming
    Replies: 15
    Last Post: 07-31-2002, 08:18 PM
  4. Programming Challenge
    By in forum Programming
    Replies: 9
    Last Post: 02-26-2002, 03:31 PM
  5. Cryptography challenge
    By ndogg in forum General Chat
    Replies: 15
    Last Post: 02-20-2002, 01:50 AM

Bookmarks

Posting Permissions

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