Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Programming Challenge 1 - Membina Segi Tiga
01-02-2012, 11:05 PM,
Post: #31
RE: Programming Challenge 1 - Membina Segi Tiga
boleh. tapi bash ke? -.- aku ni dah lah anti bash. Sad

tak pe lah. send je bash sebagai PoC. aku boleh baca lagi bash sikit-sikit. Smile

(01-02-2012, 11:00 PM)r3v3r7 Wrote: ni bley?

[Image: ayam.png]

Reply
04-02-2012, 04:09 PM, (This post was last modified: 04-02-2012, 04:11 PM by fatah.)
Post: #32
RE: Programming Challenge 1 - Membina Segi Tiga
my vote goes to ruby by johnburn. boleh singkatkan lagi rasanya tu. secondly to bash script by r3v3r7. GayFace
̿ ̿ ̿̿'̿̿\̵͇̿̿\=(•̪●)=/̵͇̿̿/'̿̿ ̿ ̿ ̿ - انا کڤيتݢولوڠ
http://fatah.afraid.org/
[Image: 763440762.png]
Reply
04-02-2012, 09:29 PM,
Post: #33
RE: Programming Challenge 1 - Membina Segi Tiga
(04-02-2012, 04:09 PM)kapitgulung Wrote: my vote goes to ruby by johnburn. boleh singkatkan lagi rasanya tu. secondly to bash script by r3v3r7. GayFace

Ni:
Code:
for c in (1..a)
    puts " " * (a-c) + "* " * c
    b+=1
end

bleh gak jd cmni kut:
Code:
1..a.each { |c| puts " " * (a-c) + "* " * c }

xtry sbb skang xda ruby ;d
[̲̅ə̲̅٨̲̅٥̲̅٦̲̅]
i ℓ٥ﻻ ﻉ√٥υ F٥rﻉ√ﻉr ღ
|_|0|_|
|_|_|0|
|0|0|0|
http://jonhburn2.freehostia.com/lol.txt
Reply
04-02-2012, 10:57 PM,
Post: #34
RE: Programming Challenge 1 - Membina Segi Tiga
dah pm abam ph33kr1 GayFace
  ▲  ʙᴇ ɴɪᴄᴇ ᴛᴏ ᴏᴛʜᴇʀs
▲ ▲ ( ⌣́,   ⌣̀ )\(^◡^ )[Image: ?r=OrangeCoral]

Reply
06-02-2012, 03:05 AM,
Post: #35
RE: Programming Challenge 1 - Membina Segi Tiga
Assalamualaikum / Salam Sejahtera,

tamatlah sudah Programming Challenge 1. Saya ingin memhon maaf atas kelewatan untuk publish PoC memandangkan semalam saya habiskan masa dengan Ubuntu-my Meetup dekat Kepong dan hari ini pula saya habiskan masa menonton Dragon Ball GT yang telah dipost oleh @[blaze08] dekat -.-
Code:
http://w3.tbd.my/thread-11188-post-128339.html#pid128339

Jadi, berikut ialah PoC yang saya terima daripada ahli-ahli tbd.my. TAHNIAH saya ucapkan! Big Grin
@[smael] - C
Code:
#include <stdio.h>

int pyramid(int d, int e)
{
    int i;
    int j;
    
    for(j = d; j > 0; j--)
        printf(" ");

    for (i = (e - d); i >= 0; i--)
        printf("%c", '*');
    
    for (i = (e - d); i >= 0; i--)
        printf("%c", i != 0 ? '*' : '\n');
    
    d--;
    return d >= 0 ? pyramid(d, e) : 0;
}

int main(int argc, char* argv[])
{
    int lebar = 39;
    int d = lebar / 2;
    int e = d;
    
    return pyramid(d, e);
}

@[johnburn] - Python
Code:
#!/usr/bin/env python

a=int(input('Lebar tapak: '))
b=1
c=0
while b < (a+1):
    print(" "*(a-c))+(b*'* ')+(" "*(a-c))
    b+=1
    c+=1

@[c0mrade] - C
Code:
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv)
{
    int r, c, t;
    
    printf("Lebar tapak segitiga:");
    scanf("%d",&t);
    
    for (r = 1; r <=t; r++)
    {
        for (c = 1; c < t; c++)
            printf(" ");

        t--;

        for (c = 1; c <= 2 * r - 1; c++)
            printf("*");
        
        printf("\n");
    }

    return (EXIT_SUCCESS);
}

@[try] - C++
Code:
#include <iostream>
using namespace std;

int main()
{
    int row, column, lebar;
    
    cout<<"Lebar tapak segitiga: ";
    cin>>lebar;
    
    for (row = 1; row <=lebar; row++)
    {
        for (column = 1; column < lebar; column++)
            cout<<" ";
        
        lebar--;
        
        for (column = 1; column <= 2 * row - 1; column++)
            cout<<"*";
        
        cout<<"\n";
    }
    
    return 0;
}

@[Ahlspiess] - PHP
Code:
<?php
$Il = $argv[1];
for($l=1;$l<=$Il;$l++) {
    for($I=1;$I<$Il;$I++)
    print " ";
    $Il--;
    for($I=1;$I<=2*$l-1;$I++) {
        print "*";
    }
    print "\n";
}
?>

@[p0pc0rn] - Javascript
Code:
<html>
<title> HTML Skrip Buat Piramid Star </title>
<style type="text/css">
.row
{
width:900px;
}
.center
{
text-align:center;
}
input
{
text-align:right;
width:50px;
}
</style>
<body>
<input type="text" name="lebar" id="lebar"><br />
<button onclick="draw()">Sila Masukkan Lebar Piramid</button>
<div id="hasil">
</div>
</body>

<script type="text/javascript">
function draw()
{
var r='';
var k=parseInt(document.getElementById('lebar').value);
for (i=0;i<=k;i++)
{
    r+='<div class="row center">';
    for (j=0;j<i;j++)
        r+='*';
    r+='</div>';
}
q=document.getElementById('hasil').innerHTML=r;
}
</script>
</html>

@[r3v3r7] - Bash
Code:
#!/bin/bash

printf "Lebar Tapak:"; ##print dulu
read lebar; ##simpan variable

rows=${1:-$lebar}               ## jumlah row
max=$(( $rows * 1 + 1 ))   ## jumlah panjang row

## buat je star kasi bnyk dlu nnt die adjust
stars='*   *   *   *   *   *   *   *   *   *   *   '
while [ ${#stars} -lt $max ]
do
  stars=$stars$stars$stars
done

n=0 ## mula ngn 0
##loop je pastu indend star tu..
while [ $(( n += 1 )) -le $rows ]
do
  indent=$(( ($rows - $n) * 2 ))
  len=$(( $n * 4 ))
  printf " %${indent}s%$len.${len}s\n" '' "$stars"
done

@[#l0u7] - Java
Code:
import java.util.Scanner;

public class pyramid
{
  public static void main(String[] tbd)
  {
    int base,clmn,flg = 1,spcing;
    Scanner sc = new Scanner(System.in);
    
    System.out.print("Masukkan Tapak Piramid : ");
    base = sc.nextInt();
    
    clmn = 1;
    for(int hght = 0; hght < base; hght++)
    {
      System.out.print("\n");
      
      for(int ast = 0; ast < clmn; ast++)
      {
        if(flg != -1)
        {
          for(int spc = 0; spc < (base-hght);spc++)
          {
            System.out.print(" ");
          }
        }
        
        System.out.print(" *");
        flg = -1;
      }
      
      clmn++;
      flg = 1;
    }
  }
}

@[wcypierre] - C++
Code:
#include <iostream>
#include <iomanip>

using namespace std;

void eout(int end){
    for(int index = 0; index <= end; index++){
        cout << "* ";
    }
}

int main(){
    int index;
    int end = 20; // Change this to make a bigger/smaller triangle
    int half = (end / 2);

    half += 25;

    for(index = 0; index < end; index++){
        cout << setw(half - index);
        eout(index);
        cout << endl;
    }
    cin.get();
    cin.get();
    return 0;
}

Kepada beberapa lagi ahli lain yang saya minta betulkan PoC, korang masih mempunyai masa untuk submit PoC korang. last sekali esok sebab esok juga saya akan submit PoC saya. Smile
Reply
06-02-2012, 12:23 PM,
Post: #36
RE: Programming Challenge 1 - Membina Segi Tiga
gwbasic, qbasic ngan pascal agak2 boleh accept tak? ;)
[Image: mysiggy.jpg]
Reply
06-02-2012, 12:53 PM, (This post was last modified: 06-02-2012, 12:55 PM by s3m00t.)
Post: #37
RE: Programming Challenge 1 - Membina Segi Tiga
walaupun gwbasic ngan qbasic ada menggunakan nama basic, aku tak reti. pascal pun aku tak reti juga. Sad

tapi, kalau nak post PoC terus dekat sini, boleh aja sebab chal dah tamat! Smile baru banyak sikit variasi contoh yang ada. Big Grin

(06-02-2012, 12:23 PM)t_qooze Wrote: gwbasic, qbasic ngan pascal agak2 boleh accept tak? ;)

Reply
06-02-2012, 03:05 PM,
Post: #38
RE: Programming Challenge 1 - Membina Segi Tiga
nak join bleh ? guna C#
[Image: vRqQN.png]

Code:
using System;

namespace Piramid
{
    class Program
    {
        public static void Main(string[] args)
        {
            Console.Write("Masukkan saiz lebar tapak piramid : ");
            int lebar = int.Parse(Console.ReadLine());
            Console.Write("\n");
            
            // TODO: Implement Functionality Here
            
        for (int row = 1; row <=lebar; row++)
                {
            int column;
                    for ( column = 1; column < lebar; column++)
                        Console.Write(" ");
                        lebar--;
            
                    for (column = 1; column <= 2 * row - 1; column++)
                        Console.Write("*");
                    Console.Write("\n");
            }
            Console.Write("\nCoded By : kbs - 6/2/12\n");
            Console.Write("Press any key to die... ");
            Console.ReadKey(true);
        }
    }
}
Reply
06-02-2012, 03:22 PM,
Post: #39
RE: Programming Challenge 1 - Membina Segi Tiga
baru ingat nak share PoC dalam C#. dah ada cantik lah! Big Grin

(06-02-2012, 03:05 PM)kbs Wrote: nak join bleh ? guna C#
[Image: vRqQN.png]

Code:
using System;

namespace Piramid
{
    class Program
    {
        public static void Main(string[] args)
        {
            Console.Write("Masukkan saiz lebar tapak piramid : ");
            int lebar = int.Parse(Console.ReadLine());
            Console.Write("\n");
            
            // TODO: Implement Functionality Here
            
        for (int row = 1; row <=lebar; row++)
                {
            int column;
                    for ( column = 1; column < lebar; column++)
                        Console.Write(" ");
                        lebar--;
            
                    for (column = 1; column <= 2 * row - 1; column++)
                        Console.Write("*");
                    Console.Write("\n");
            }
            Console.Write("\nCoded By : kbs - 6/2/12\n");
            Console.Write("Press any key to die... ");
            Console.ReadKey(true);
        }
    }
}

Reply
06-02-2012, 03:28 PM,
Post: #40
RE: Programming Challenge 1 - Membina Segi Tiga
lama aku x masuk TBD.. dah ada awek pula kat sini..
We live among its people now, hiding in plain sight... but watching over them in secret... waiting... protecting. I have witnessed their capacity for courage, and though we are worlds apart, like us, there's more to them than meets the eye..
Reply
06-02-2012, 03:38 PM,
Post: #41
RE: Programming Challenge 1 - Membina Segi Tiga
pergh! bukan nak cakap "dah ada programming challenge". boleh cakap "dah ada awek"~ Sad

(06-02-2012, 03:28 PM)123 Wrote: lama aku x masuk TBD.. dah ada awek pula kat sini..

Reply
06-02-2012, 04:17 PM,
Post: #42
RE: Programming Challenge 1 - Membina Segi Tiga
(06-02-2012, 03:38 PM)ph33kr1 Wrote: pergh! bukan nak cakap "dah ada programming challenge". boleh cakap "dah ada awek"~ Sad

(06-02-2012, 03:28 PM)123 Wrote: lama aku x masuk TBD.. dah ada awek pula kat sini..


tu yang terbaik tu~ GayFace
Dunia Penuh "Pancut Raba" Fuck That Shit
Reply
06-02-2012, 06:09 PM,
Post: #43
RE: Programming Challenge 1 - Membina Segi Tiga
(06-02-2012, 03:38 PM)ph33kr1 Wrote: pergh! bukan nak cakap "dah ada programming challenge". boleh cakap "dah ada awek"~ Sad
programing dah slalu ada..awek kt dlm board je jarang ada...
kbs, ko taw asp.net ? ada job. wat kat umah leh.. PM me klu nak yep. utk girl je..hahaaha
We live among its people now, hiding in plain sight... but watching over them in secret... waiting... protecting. I have witnessed their capacity for courage, and though we are worlds apart, like us, there's more to them than meets the eye..
Reply
06-02-2012, 06:15 PM,
Post: #44
RE: Programming Challenge 1 - Membina Segi Tiga
pergh! guna asp.net untuk rampas kbs. Sad dah lah utk gegirl je. Sad kbs, reti PHP tak? Evil

PM me asap juga. GayFace tak tau sebab apa... just PM je. XD

(06-02-2012, 06:09 PM)123 Wrote: programing dah slalu ada..awek kt dlm board je jarang ada...
kbs, ko taw asp.net ? ada job. wat kat umah leh.. PM me klu nak yep. utk girl je..hahaaha

Reply
06-02-2012, 08:48 PM,
Post: #45
RE: Programming Challenge 1 - Membina Segi Tiga
(06-02-2012, 06:09 PM)123 Wrote:
(06-02-2012, 03:38 PM)ph33kr1 Wrote: pergh! bukan nak cakap "dah ada programming challenge". boleh cakap "dah ada awek"~ Sad
programing dah slalu ada..awek kt dlm board je jarang ada...
kbs, ko taw asp.net ? ada job. wat kat umah leh.. PM me klu nak yep. utk girl je..hahaaha

jarang ada? aku yg hari2 online ni bukan awek hot ke kat sini? GayFace
fikri, celen ni ada part 2 plak ke?
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Challenge - Paan 0b0x3d 7 836 11-12-2013, 02:42 AM
Last Post: JohnWhite
  TBD Challenge #1, Menang RM100 suhz 99 15,014 14-11-2013, 01:43 AM
Last Post: RFC792
  php reverse challenge lvl easy firdaushatta 10 1,009 25-07-2013, 02:18 AM
Last Post: firdaushatta
  [TBD Challenge] Data Forensic v0.0.0.0.0xXXXX1029939392 RFC792 24 2,630 06-07-2013, 07:12 PM
Last Post: RFC792
  Steganography Challenge suhz 35 2,763 04-07-2013, 01:18 PM
Last Post: Codeshift3r
  [TBD Challenge] Log Analysis Challenge #1 ak47suk1 15 1,489 01-07-2013, 11:00 PM
Last Post: shahril
  [PHP] Challenge Reverse This Function ! shahril 12 1,271 26-06-2013, 12:58 PM
Last Post: akif
  Firefly Challenge UnKn0wN 24 2,919 28-10-2012, 09:33 PM
Last Post: shadowmacx
  Wargames2012 Challenge Ahlspiess 26 4,753 21-07-2012, 06:19 PM
Last Post: kryp70
  Pijat challenge #1 pijat 5 1,252 20-06-2012, 11:05 PM
Last Post: kryp70

Forum Jump: