|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming | |
Programming Challenge
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#21 (permalink) | |||||||||||||
|
Programmer
|
I'm now in my third iteration of a spell checker. The first was only in C, using C strings, the second was in C++ but with out the <string> class, so we had to write our own, and our own ordered container. Now we get to use all of the standard library, but have tons of new features. Ugh... so much work. In DB class we're simulating a database using C++. And in my Java class I have some new project out but I didn't go to class so I have no idea what it is
. 3 programming classes = getting owned. Off to the library to study for my DB exam tomorrow ![]()
__________________
Whats this folding I've been hearing about? Crucial Ballistix Club ![]() Member of the OCN Diablo III Club ~M Hail to the Victors M~
|
|||||||||||||
|
|
|
|
#22 (permalink) | ||||||||||||
|
Intel Overclocker
|
Here's my response- its written for the Java Console. Put this into Eclipse or something, compile, and run...it'll do the job. You I know there's a more efficient way to manage the encoding key for decoding text, but i don't really have a lot of time right now (exams for high school).
import java.util.*; public class Encode { static Scanner scan; public static void main(String[] args) { final int tSize = 200; scan = new Scanner(System.in); System.out.println("Would you like to <1> Encode or <2> Decode a message?"); if(scan.nextInt()==1) encode(tSize); else decode(tSize); } public static void encode(int tableSize) { Hashtable<Character, Character> table = new Hashtable<Character, Character>(); table.put((char)0, (char)tableSize); for(int i=1; i<tableSize-1; i++) table.put((char)i, (char)(i+1)); String input="", output=""; System.out.println("Hey, input a string!"); scan = new Scanner(System.in); input = scan.nextLine(); for(int i=0; i<input.length(); i++) { output+=""+table.get(input.charAt(i)); } System.out.println("This is the encoded text: "+output); } public static void decode(int tableSize) { Hashtable<Character, Character> table = new Hashtable<Character, Character>(); table.put((char)tableSize, (char)0); for(int i=2; i<tableSize; i++) table.put((char)i, (char)(i-1)); String input="", output=""; System.out.println("Hey, input an encoded string!"); scan=new Scanner(System.in); input = scan.nextLine(); for(int i=0; i<input.length(); i++) { output+=""+table.get(input.charAt(i)); } System.out.println("This is the decoded text: "+output); } } Oh crap...the indents are screwed up. Lemme zip it up real quick
__________________
92% of teens have moved on to rap. If you are part of the 8% who still listen to real music, copy and paste this. NVIDIA![]() ![]()
Last edited by Admiral Doom : 01-08-08 at 09:16 PM. |
||||||||||||
|
|
|
|
|
#23 (permalink) | ||||||||||||
|
Intel Overclocker
|
Ok it should be here...unzip and open with Eclipse
__________________
92% of teens have moved on to rap. If you are part of the 8% who still listen to real music, copy and paste this. NVIDIA![]() ![]()
|
||||||||||||
|
|
|
|
|
#24 (permalink) | |||||||||||||
|
Case Modder
|
Just stumbled into the thread, I'll look forward to the next installment. By the way, for anyone that was curious, the specific name of that type of cipher is called a "ceasar shift" ... because Julius Ceasar (supposedly) used a three character shift pattern as a means of communicating securely with his generals. :shrug:
__________________
|
|||||||||||||
|
|
|
|
|
#25 (permalink) | |||||||||||||
|
Programmer
|
When is the next challenge comming? These look awfully easy
__________________ . How about a 24 hour challenge?
|
|||||||||||||
|
|
|
|
#26 (permalink) | |||||||||||||
|
Mmmm! Toast!
|
Quote:
Yes yes!
__________________
Rocket 3 down-payment fund: [|||||||||] $6k e6750 @ 3.2 Ghz (400x8) - 7k ppd GPU+SMP
|
|||||||||||||
|
|
|
|
#27 (permalink) | |||||||||||||
|
Programmer
|
If you could pull enough people together for a 24h session i could moderate it and come up with a few challenges, ive done my fair share of them and know a few good ones
__________________![]()
|
|||||||||||||
|
|
|
|
#28 (permalink) | ||||||||||||||
|
OLPC XO developer
![]() |
I'd love to start some more challenges. We'd need to have some that are fairly hard and some that can be easy as not everyone is at the same level here and we want to include as many people as possible. Post up some possible challenges and we can move forward from there. A 24 hour challenge sounds fun too.
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn Try out the latest Programming Challenge Quote:
CPU-Z Validation @ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15 Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More
|
||||||||||||||
|
|
|
|
#29 (permalink) | ||||||||||||
|
New to Overclock.net
|
Why not use the ACM programming contest stuff? One of my profs has a bunch of the problem sets on his school web space, but you'd have to trust people not to cheat and look at the answers.
__________________
|
||||||||||||
|
|
|
|
|
#30 (permalink) | ||||||||||||
|
Mmmm! Toast!
|
OOoooRR! I could post some problems I have *cough* at work
I'm not lazy! I'm efficient!
__________________
Rocket 3 down-payment fund: [|||||||||] $6k e6750 @ 3.2 Ghz (400x8) - 7k ppd GPU+SMP
|
||||||||||||
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|