New Posts  All Forums:Forum Nav:

My Super Program - Page 2

post #11 of 32
Quote:
Originally Posted by pioneerisloud View Post
Yeah, I have absolutely NO clue what that says. Looks cool though. Looks like oober 1337 haxorz attempts!!!
It's funny how I spend my time reading code rather than compiling it...

It looks, overall, like relatively simple code, but a good way to learn and expand upon the C++ language. Now I'm just starting to learn C++ myself.
post #12 of 32
Quote:
Originally Posted by Sgt.Collins View Post
so what kind of application is it
Looks to be a couple of number converters.
Thudd
(16 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II 720 x3 MSI 790FX-GD70 Radeon 6770 OCZ 6GB (3 x 2GB) DDR3 1600 
Optical DriveCoolingOSMonitor
Samsung Blue Ray Eater SO MANY FANS Windows 7 x64 SP1(Do not go gentle) Acer AL2216W 1680x1050 
MonitorMonitorKeyboardPower
Cheap 32" LED TV 50" Samsung Plasma Garbage OCZ 700W M#OCZGXS700 
CaseMouseMouse Pad
Thudd MX518(Rage, rage against the dying of the light) Leather desktop 
  hide details  
Reply
Thudd
(16 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II 720 x3 MSI 790FX-GD70 Radeon 6770 OCZ 6GB (3 x 2GB) DDR3 1600 
Optical DriveCoolingOSMonitor
Samsung Blue Ray Eater SO MANY FANS Windows 7 x64 SP1(Do not go gentle) Acer AL2216W 1680x1050 
MonitorMonitorKeyboardPower
Cheap 32" LED TV 50" Samsung Plasma Garbage OCZ 700W M#OCZGXS700 
CaseMouseMouse Pad
Thudd MX518(Rage, rage against the dying of the light) Leather desktop 
  hide details  
Reply
post #13 of 32
Thread Starter 
K I uploaded the EXE to the boar din my first post. Enjoy guys . Also I'm beta testing / coding a Information saver to save friends numbers,names, etc since I seen it on this board and thought coding one into this program would be awesome .
post #14 of 32
Hah, that was probably mine.
ragequit
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q9550 4ghz @ 1.25v Asus Max 2 formula 8800gtx 610/1ghz OCZ LV blade 1:1 950mhz 
Hard DriveOptical DriveOSMonitor
7200.10 250gb dvd leetlinucks 24" Westy 
KeyboardPowerCaseMouse
G15 750w Toughpower Lian li pc-65 Copperhead 
Mouse Pad
Thermtaltake? 
  hide details  
Reply
ragequit
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q9550 4ghz @ 1.25v Asus Max 2 formula 8800gtx 610/1ghz OCZ LV blade 1:1 950mhz 
Hard DriveOptical DriveOSMonitor
7200.10 250gb dvd leetlinucks 24" Westy 
KeyboardPowerCaseMouse
G15 750w Toughpower Lian li pc-65 Copperhead 
Mouse Pad
Thermtaltake? 
  hide details  
Reply
post #15 of 32
that is cool! i want to start learning that now
computer
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Q6600 Quad Core Abit IP35 Pro XFX 9800GT 2gb Crucial Ballistix 
Hard DriveOptical DriveOSMonitor
250gb Western Digital SATA Lite On DVD Windows Vista Home Premium 32 Bit 22" AOC 2216Sw 
KeyboardPowerCaseMouse
Razer Lycosa 700w OCZ Game X Stream Raidmax Smilodon Extreme Black Razer Diamondback 
Mouse Pad
Fragmat 
  hide details  
Reply
computer
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Q6600 Quad Core Abit IP35 Pro XFX 9800GT 2gb Crucial Ballistix 
Hard DriveOptical DriveOSMonitor
250gb Western Digital SATA Lite On DVD Windows Vista Home Premium 32 Bit 22" AOC 2216Sw 
KeyboardPowerCaseMouse
Razer Lycosa 700w OCZ Game X Stream Raidmax Smilodon Extreme Black Razer Diamondback 
Mouse Pad
Fragmat 
  hide details  
Reply
post #16 of 32
Ha those are those fun little programs you learn in the first few months. Cool to see them all together like that.
    
CPUGraphicsRAMHard Drive
Core i5 M 520 NVS 3100M G.SKILL 8GB (2 x 4GB) 204-Pin DDR3 SO-DIMM DDR3... OCZ Vertex 3 128GB 
  hide details  
Reply
    
CPUGraphicsRAMHard Drive
Core i5 M 520 NVS 3100M G.SKILL 8GB (2 x 4GB) 204-Pin DDR3 SO-DIMM DDR3... OCZ Vertex 3 128GB 
  hide details  
Reply
post #17 of 32
Buddy, switch statements! I believe that would help you a great deal.
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
post #18 of 32
one thing I noticed in the 7 seconds I scanned it, you have no error checking. If the user inputs "banana" as their menu choice, your program isn't going to do anything. I'd A) have a default: statement in your switch statement so if any thing comes through that isn't 1-15, it will print an error and run it again. B) I'd probably make some sort of error checking function that returned true or false if the input was acceptable. Lastly, I'd run that switch statement in a while loop, so people can use more than 1 of your functions when they use the program.

Let me know if you have any questions.
It's about time!
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 G0 @3.3Ghz Gigabyte EP45-UD3P Sapphire 2900Pro Flashed to XT 4Gb Gskill 1066Mhz PK's 
Hard DriveOptical DriveOSMonitor
Seagate Barracuda 320Gb & WD Black 640Gb Lite On Vista Business and VMWare Ubuntu Acer AL2223W 22" 
KeyboardPowerCaseMouse
Ergonomic 4000 Corsair HX 620W CM 690 G5 
  hide details  
Reply
It's about time!
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 G0 @3.3Ghz Gigabyte EP45-UD3P Sapphire 2900Pro Flashed to XT 4Gb Gskill 1066Mhz PK's 
Hard DriveOptical DriveOSMonitor
Seagate Barracuda 320Gb & WD Black 640Gb Lite On Vista Business and VMWare Ubuntu Acer AL2223W 22" 
KeyboardPowerCaseMouse
Ergonomic 4000 Corsair HX 620W CM 690 G5 
  hide details  
Reply
post #19 of 32
Nice program! Now refactor it. Refactoring is changing your code so that it makes adding future functionality EASIER and FASTER.

1. Take everything inside of each case statement and move it to its own function. That's 13-14 functions for you.

2. Look for sets of two of more functions that have similar behavior and vary slightly, then merge each set into a single function using parameters to achieve the varying behavior.

For example, don't the dog years and cat years calculations look similar? What varies between those two snippets? Can you think of how to make a single function with parameters that could calculate dog or cat years AND takes less code than your current implementation?

3. If you're really feeling hopped up and want to try something advanced with classes, now take a look at that switch. Any time you see a big switch you should think about encapsulating what varies. What if you created a "command" object for each function and corresponding English description? (For instance, FibonacciCommand.invoke() writes the Fibonacci sequence to a file. FibonacciCommand.getDescription() returns "Fibonacci Sequence". FibonacciCommand, then, is one of several classes that implements or extends Command, which is either an abstract class or interface that enforces the implementation of invoke and getDescription, and gives your main program a common TYPE to deal with.) Now you can create new instances of the command objects and store them in an array. Loop through the array to print out your menu. When you receive input, look up the object from the array based on the number entered, and invoke the command from said object. Adding more commands to your program is simply creating a new command class and adding an instance of it to the array.

This last kind of refactoring creates a lot of new classes, so it's work with little short term value to show for it. However, it pays off in the long run if you continue to develop this into a large application. The first two refactorings, however, make your code shorter, particularly your main function (which is huge), and makes everything easier to read. A good rule of thumb is if you can't see the entire function on screen at once, it needs to be broken up into smaller functions.

And of course, what was said previously about error checking is totally correct. Error checking good.
    
CPUGraphicsRAMHard Drive
Intel 2.4 Core i7 AMD Radeon HD 6750M 8 GB 1067 MHz DDR3 750 GB 
OS
Mac OS-X Lion 
  hide details  
Reply
    
CPUGraphicsRAMHard Drive
Intel 2.4 Core i7 AMD Radeon HD 6750M 8 GB 1067 MHz DDR3 750 GB 
OS
Mac OS-X Lion 
  hide details  
Reply
post #20 of 32
Thread Starter 
Ok I will work on adding some of these ideas. The only real problem is the whole thing about making it be able to restart the app after a operation. I've never done it before so I'm still newbie lol.
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Application Programming