Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › The Programming Challenge Master Thread
New Posts  All Forums:Forum Nav:

The Programming Challenge Master Thread - Page 4

post #31 of 263
I think the questions would have to get a lot harder before they would be challenging enough to be classed as "practice".

I think if you add requirements like "using the least lines of code", "most optimal code", or even "using the fewest variables", etc then it's more interesting on an intellectual level as it's more than just chucking out working code.

In the spirit of challenges, I might have a play with rewriting my Perl code in Brain****, if I get time tomorrow smile.gif
post #32 of 263
For practicing it is good in this way especially with the spreadsheet, though if we can figure out something that would give something to compete in with the others that would be even better smile.gif

I do it because practice is always handy, but competing with each other is always fun.
Footrest
(17 items)
 
server
(17 items)
 
HTPC
(12 items)
 
CPUMotherboardGraphicsRAM
2 x Xeon L5520 Supermicro X8DTL-i HD4550 Samsung 6x4GB ECC 
Hard DriveHard DriveCoolingOS
3 x 2TB WD Green 160GB WD Blue Hyper 212+ and EVO ESXi 
OSOSOSPower
unRaid pfSense Ubuntu CX430v2 
CaseOtherOther
CM Elite 331 TP-Link TG-3269 Sil3512 Sata controller 
CPUMotherboardRAMHard Drive
i3-2100T Asus P8H61-I Geil Black Dragon 1333 2x2GB PXE Network boot 
Optical DriveCoolingOSMonitor
OEM Slim DVD Burner Scythe Big-Shuriken OpenElec Panasonic TX-P42G30E 42" HDTV 
KeyboardCase
Lenovo n5901a Silverstone SG-05 
  hide details  
Reply
Footrest
(17 items)
 
server
(17 items)
 
HTPC
(12 items)
 
CPUMotherboardGraphicsRAM
2 x Xeon L5520 Supermicro X8DTL-i HD4550 Samsung 6x4GB ECC 
Hard DriveHard DriveCoolingOS
3 x 2TB WD Green 160GB WD Blue Hyper 212+ and EVO ESXi 
OSOSOSPower
unRaid pfSense Ubuntu CX430v2 
CaseOtherOther
CM Elite 331 TP-Link TG-3269 Sil3512 Sata controller 
CPUMotherboardRAMHard Drive
i3-2100T Asus P8H61-I Geil Black Dragon 1333 2x2GB PXE Network boot 
Optical DriveCoolingOSMonitor
OEM Slim DVD Burner Scythe Big-Shuriken OpenElec Panasonic TX-P42G30E 42" HDTV 
KeyboardCase
Lenovo n5901a Silverstone SG-05 
  hide details  
Reply
post #33 of 263
Quote:
Originally Posted by Aximous View Post

For practicing it is good in this way especially with the spreadsheet, though if we can figure out something that would give something to compete in with the others that would be even better smile.gif
I do it because practice is always handy, but competing with each other is always fun.

look up wink.gif
post #34 of 263
Yea I noticed that, I was just too tired/lazy to mention it, your suggestions are cool anyway thumb.gif
Footrest
(17 items)
 
server
(17 items)
 
HTPC
(12 items)
 
CPUMotherboardGraphicsRAM
2 x Xeon L5520 Supermicro X8DTL-i HD4550 Samsung 6x4GB ECC 
Hard DriveHard DriveCoolingOS
3 x 2TB WD Green 160GB WD Blue Hyper 212+ and EVO ESXi 
OSOSOSPower
unRaid pfSense Ubuntu CX430v2 
CaseOtherOther
CM Elite 331 TP-Link TG-3269 Sil3512 Sata controller 
CPUMotherboardRAMHard Drive
i3-2100T Asus P8H61-I Geil Black Dragon 1333 2x2GB PXE Network boot 
Optical DriveCoolingOSMonitor
OEM Slim DVD Burner Scythe Big-Shuriken OpenElec Panasonic TX-P42G30E 42" HDTV 
KeyboardCase
Lenovo n5901a Silverstone SG-05 
  hide details  
Reply
Footrest
(17 items)
 
server
(17 items)
 
HTPC
(12 items)
 
CPUMotherboardGraphicsRAM
2 x Xeon L5520 Supermicro X8DTL-i HD4550 Samsung 6x4GB ECC 
Hard DriveHard DriveCoolingOS
3 x 2TB WD Green 160GB WD Blue Hyper 212+ and EVO ESXi 
OSOSOSPower
unRaid pfSense Ubuntu CX430v2 
CaseOtherOther
CM Elite 331 TP-Link TG-3269 Sil3512 Sata controller 
CPUMotherboardRAMHard Drive
i3-2100T Asus P8H61-I Geil Black Dragon 1333 2x2GB PXE Network boot 
Optical DriveCoolingOSMonitor
OEM Slim DVD Burner Scythe Big-Shuriken OpenElec Panasonic TX-P42G30E 42" HDTV 
KeyboardCase
Lenovo n5901a Silverstone SG-05 
  hide details  
Reply
post #35 of 263
Alright I will be attempting to do this over the weekend. Probably after Thanksgiving.
My rig
(18 items)
 
  
CPUMotherboardGraphicsRAM
4770k M power EVGA GTX 980 SC G.SKILL Sniper (2 x 4GB) DDR3 1600 9-9-9-24 
Hard DriveCoolingOSMonitor
512GB Samsung 940 Pro h100 Windows 8 Home premium Asus VG248QE 
MonitorKeyboardPowerCase
Asus VG248QE Corsair K90 Kingwin Lazer Gold 850w Fractal Design Arc Midi R2 
MouseMouse PadAudioAudio
Logitech G700s Corsair Asus Xonar M-Audio BX5 d2 
Audio
krk 10s 
  hide details  
Reply
My rig
(18 items)
 
  
CPUMotherboardGraphicsRAM
4770k M power EVGA GTX 980 SC G.SKILL Sniper (2 x 4GB) DDR3 1600 9-9-9-24 
Hard DriveCoolingOSMonitor
512GB Samsung 940 Pro h100 Windows 8 Home premium Asus VG248QE 
MonitorKeyboardPowerCase
Asus VG248QE Corsair K90 Kingwin Lazer Gold 850w Fractal Design Arc Midi R2 
MouseMouse PadAudioAudio
Logitech G700s Corsair Asus Xonar M-Audio BX5 d2 
Audio
krk 10s 
  hide details  
Reply
post #36 of 263
Quote:
Originally Posted by Aximous View Post

Yea I noticed that, I was just too tired/lazy to mention it, your suggestions are cool anyway thumb.gif

ahh cool smile.gif
post #37 of 263
My solution in C
Code:
#include <stdio.h>
#include <stdlib.h>

int main() {

        int stars = 8;
        for(int i = stars; i >= stars * -1; i--) {
                for(int j = (stars - abs(i)); j > 0; j--)
                        printf("*");
                printf("\n");
        }
        
}
eyefinity
(22 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 2600K EVGA E685 Radeon HD 6970 Radeon HD 6970 
RAMRAMHard DriveCooling
G.Skill SNIPER G.Skill SNIPER Crucial M4 128GB 6970 EK Water Block Acetal + Nickel 
CoolingCoolingCoolingOS
Swiftech MCR320-QP Radiator Swiftech MCP655 Pump EK Supreme HF CPU Block Windows 7 Ultimate 
MonitorMonitorMonitorKeyboard
Dell E228WFP Dell E228WFP Dell P2210 G510 
PowerCaseMouseMouse Pad
TX850 HAF932 BE G500 XTRAC PADS Ripper 
Audio
G930 
  hide details  
Reply
eyefinity
(22 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 2600K EVGA E685 Radeon HD 6970 Radeon HD 6970 
RAMRAMHard DriveCooling
G.Skill SNIPER G.Skill SNIPER Crucial M4 128GB 6970 EK Water Block Acetal + Nickel 
CoolingCoolingCoolingOS
Swiftech MCR320-QP Radiator Swiftech MCP655 Pump EK Supreme HF CPU Block Windows 7 Ultimate 
MonitorMonitorMonitorKeyboard
Dell E228WFP Dell E228WFP Dell P2210 G510 
PowerCaseMouseMouse Pad
TX850 HAF932 BE G500 XTRAC PADS Ripper 
Audio
G930 
  hide details  
Reply
post #38 of 263
Quote:
Originally Posted by morethantoast View Post

My solution in C
Code:
#include <stdio.h>
#include <stdlib.h>
int main() {
        int stars = 8;
        for(int i = stars; i >= stars * -1; i--) {
                for(int j = (stars - abs(i)); j > 0; j--)
                        printf("*");
                printf("\n");
        }
        
}

I like that. That's a good solution
post #39 of 263
Thread Starter 
Quote:
Originally Posted by morethantoast View Post

My solution in C
Code:
#include <stdio.h>
#include <stdlib.h>
int main() {
int stars = 8;
for(int i = stars; i >= stars * -1; i--) {
for(int j = (stars - abs(i)); j > 0; j--)
printf("*");
printf("\n");
}

}

Good job. But there are a few little problems with your code:

1. You declared the variables i and j within the for loop. You should have declared them outside the loop.

2. You forgot to exit from the program; it gives an exit failure when compiled.

3. There's just one more little problem: the first and the last lines of the output don't show any stars. But it doesn't really matter much.

Overall, good job.thumb.gif Much better than I could have done. "Programming" is much much more important than "coding" and it's the algorithm that matters.

P.S. I don't know C very well. I used a little bit of my Java knowledge and little bit of google. biggrin.gif
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
post #40 of 263
Quote:
Originally Posted by {Unregistered} View Post

Good job. But there are a few little problems with your code:
1. You declared the variables i and j within the for loop. You should have declared them outside the loop.
2. You forgot to exit from the program; it gives an exit failure when compiled.
3. There's just one more little problem: the first and the last lines of the output don't show any stars. But it doesn't really matter much.
Overall, good job.thumb.gif Much better than I could have done. "Programming" is much much more important than "coding" and it's the algorithm that matters.
P.S. I don't know C very well. I used a little bit of my Java knowledge and little bit of google. biggrin.gif

It's convention to declare iteration variables such as i and j within the for loop. They certainly could be declare before the for loops, but you rarely see it done like that.

Actually, most compilers don't require that you return from main(). If a return is omitted, it'll be added at compile time. My code compiles fine in GCC.
eyefinity
(22 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 2600K EVGA E685 Radeon HD 6970 Radeon HD 6970 
RAMRAMHard DriveCooling
G.Skill SNIPER G.Skill SNIPER Crucial M4 128GB 6970 EK Water Block Acetal + Nickel 
CoolingCoolingCoolingOS
Swiftech MCR320-QP Radiator Swiftech MCP655 Pump EK Supreme HF CPU Block Windows 7 Ultimate 
MonitorMonitorMonitorKeyboard
Dell E228WFP Dell E228WFP Dell P2210 G510 
PowerCaseMouseMouse Pad
TX850 HAF932 BE G500 XTRAC PADS Ripper 
Audio
G930 
  hide details  
Reply
eyefinity
(22 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 2600K EVGA E685 Radeon HD 6970 Radeon HD 6970 
RAMRAMHard DriveCooling
G.Skill SNIPER G.Skill SNIPER Crucial M4 128GB 6970 EK Water Block Acetal + Nickel 
CoolingCoolingCoolingOS
Swiftech MCR320-QP Radiator Swiftech MCP655 Pump EK Supreme HF CPU Block Windows 7 Ultimate 
MonitorMonitorMonitorKeyboard
Dell E228WFP Dell E228WFP Dell P2210 G510 
PowerCaseMouseMouse Pad
TX850 HAF932 BE G500 XTRAC PADS Ripper 
Audio
G930 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › The Programming Challenge Master Thread