Close
Duke shfaqur rezultatin -9 deri 0 prej 2
  1. #1

    Java - Pyetje per nje algoritem

    Problemi eshte ky: kam nje file text te tipit :
    begin()
    funksioni1;
    funksioni2;
    end()

    begin()
    end()

    begin()
    end()

    begin()
    funksioni1;
    end()
    ky file lexohet rresht per resht (while readLine!=null) dhe cdo resht shkruhet i modifikuar ne nje file tjeter. Si mund te kontrolloj faktin qe nqs ne input kam nje sekuence :
    ..
    begin()
    end()
    ..
    te shkruaj ne output dicka te tille:
    ..
    begin()
    funksion_no_operation;
    end();
    ..
    ... cos' I was high when i wrote this !!!

  2. #2
    Programues Softueresh Maska e edspace
    Anėtarėsuar
    04-04-2002
    Vendndodhja
    Filadelfia, SHBA
    Postime
    2,565
    Ka shume menyra per te bere kete gje.

    Nje menyre eshte qe te ruash rreshtin e meparshem dhe kur te lexosh rreshtin "end()" te shikosh nese rreshti i meparshem ishte "begin()".

    Kodi:
    while (rreshti != null) {
            if (rreshti.equals("end()") {
                    if (rreshtiVjeter.equals("begin()") {
                           System.out.println("funksion_no_operation"); 
                    }
            }
             System.out.println(rreshti);
             rreshtiVjeter = rreshti; 
    }

    Nje menyre tjeter eshte te perdoresh nje sinjal te tipit boolean qe te jete ndezur sa here qe rreshti i meparshem eshte "begin()".

    Kodi:
    while (rreshti != null) {
            if (rreshti.equals("end()") {
                    if (rreshtiBegin) {
                           System.out.println("funksion_no_operation"); 
                           rreshtiBegin = false;
                    }
            } else if (rreshti.equals("begin()") {
                     rreshtiBegin = true;
            } else {
                     rreshtiBegin = false;
            }
      
            
             System.out.println(rreshti);
             
    }
    Edi

Tema tė Ngjashme

  1. Prifeterinjte Pyesin Hoxhallaret Pergjigjen
    Nga Fjala e drejte nė forumin Komuniteti musliman
    Pėrgjigje: 29
    Postimi i Fundit: 05-02-2009, 07:33
  2. Del nė shitje "Njė dosje pėr Kadarenė"
    Nga Albo nė forumin Tema e shtypit tė ditės
    Pėrgjigje: 20
    Postimi i Fundit: 17-03-2007, 01:53
  3. C'far pyetje duhet te beni!
    Nga Noerti nė forumin Lojra dhe rebuse
    Pėrgjigje: 4
    Postimi i Fundit: 27-08-2004, 19:00
  4. Pyetje shkencore , por
    Nga Anton nė forumin Problematika shqiptare
    Pėrgjigje: 22
    Postimi i Fundit: 03-07-2004, 02:22

Regullat e Postimit

  • Ju nuk mund tė hapni tema tė reja.
  • Ju nuk mund tė postoni nė tema.
  • Ju nuk mund tė bashkėngjitni skedarė.
  • Ju nuk mund tė ndryshoni postimet tuaja.
  •