Izinhlelo eziyisisekelo ezine-pseint (ingxenye 3)

Lokhu ukuqhubeka kwesifundo Izinhlelo eziyisisekelo ezine-pseint (ingxenye 2), kulokhu ngizochaza ukuthi yini edingekayo ohlelweni.

ISABELO

Ukunikezwa kuyinqubo lapho okuguquguqukayo kudalwa khona futhi / noma kuguqulwa, kubhekiswa kukho ngokusebenzisa isikhombi sayo esingafinyelela kuso isikhala sememori yaso.

i-syntax yesabelo yile:

[variable]<- [expresion];
[variable]=[expresion];

Lapho okuguquguqukayo okuthola khona inani lokuhlaziya [isisho]. Zombili zivumelekile ngakho-ke akunandaba ukuthi iyiphi esetshenziswayo (uma ihlele i-PSeInt kahle), kepha ngombono wami ngakha eyokuqala njengeyiyona eyiyo.

Uma [okuguquguqukayo] bekungekho ngaphambi kwesabelo, [variable] kwakhiwa, uma ngabe likhona inani langaphambilini liyacekelwa phansi bese kuthi elisha libekwe endaweni yalo. Ngalesi sizathu, ukwenza imephu kuthathwa njengokusebenza okulimazayo.

UKUFUNDA

Ukufunda kuyinqubo lapho umsebenzisi ebuzwa khona idatha noma idatha yokugcina leyo datha ngokuguquguqukayo.

i-syntax yayo yile:

Leer variable_1,variable_2,...,variable_n;

lapho [okuguqukayo_ {1,2, n}] kukhona okuguquguqukayo noma okuguquguqukayo okuthola inani elinikezwe ngumsebenzisi, uma kwenzeka kucelwa okungaphezulu kokukodwa, kuzocelwa okokuqala, bese kuba kwesesibili njalonjalo kuze kube bathole wonke amanani.

Lokhu futhi kungumsebenzi owonakalisayo.

UKUBHALA

Ukubhala inqubo lapho intambo yezinhlamvu kanye / noma okuhlukile okukodwa noma okuningi kubhalwa esikrinini

i-syntax yile:

Escribir expresion_1,expresion_2,...,expresion_n;

lapho [expersion_ {1,2, n}] kukhona izintambo zezinhlamvu kanye / noma okuguqukayo okuzokhonjiswa.

Ukubhala ngokungezelela ekutholeni idatha ezofakwa esibukweni futhi ithola imiyalo "Ngaphandle kokweqa" noma "Ngaphandle kokuya phansi" evikela ukweqa komugqa.

Ukubhala akufaki izikhala phakathi kwezimpikiswano, okungukuthi, uma kufakwa:

Proceso SinTitulo
a<- "ola";
b<- "mundo";
Escribir a,b;
FinProceso

kulokhu kuzokhombisa i- «olamundo» kusukela phakathi kwe- «a» ne- «b» ayikho intambo yezinhlamvu ekhombisa isikhala esiphakathi kuka-a no-b, ukuze siboniswe kahle kubhalwe kanjena:

Proceso SinTitulo
a<- "ola";
b<- "mundo";
Escribir a,"",b;
FinProceso

kulokhu engeza »» okuyintambo yomlingiswa enesikhala esiyisikhala esiphakathi kwe- «wave» ne- «world» bese izokhombisa i- «wave world» nesikhala.

UMA KULANDELWA

Lesi yisigwebo esihlola isimo esinikeziwe bese sihlola ubuqiniso kanye / noma amanga esimo esishiwo, okungukuthi, uma isimo sihlangatshezwe noma cha.

I-syntax yayo yile:

Si [condición a evaluar] Entonces
[instrucciones por verdadero] Sino
[instrucciones por falso] FinSi

Isigatshana esithi «Okunye» asiphoqelekile, kulokhu uma isimo singamanga zishaya indiva iziqondiso bese uqhubeka sengathi isigwebo besingekho, kulokhu sizohlala:

Si [condición a evaluar] Entonces
[instrucciones por verdadero] FinSi

Ukuthi isigatshana esithi "Ukwehluleka" sabekwa noma cha kuya ngezidingo zalolo hlelo.

NGOKUSHO

Umusho njengoba uhlaziya ukuguquguquka kwamanani okuqinile okunikeza izinketho ezingaphezu kwezingu-2 njengenketho, lokhu kwehlukile ku- "Uma-ke" ngoba owedlule anganikeza izinketho ezi-2 kuphela.

I-syntax yile:

Segun [variable numérica] Hacer
[número1]: [instrucciones] [número2],[número3]: [instrucciones] [...] De Otro Modo: [instrucciones] FinSegun

Njengoba ukwazi ukubona ngemuva kwe- "number1" kukhona u ":" futhi ngemuva kwalokho imiyalo okufanele yenziwe ibekwa esimweni lapho i- "numerical variable = number1", esibonelweni sesibili ithi "number2, number3" lokhu kusho ukuthi uma " inombolo eguquguqukayo = inombolo2 noma inombolo3 "bese" imiyalo "izokwenziwa, lokhu kuyasiza lapho amathuba ama-2 kufanele enze imiyalo efanayo.

Kukhona futhi isigatshana esithi "Ngenye Indlela" esetshenziswayo uma kwenzeka ukuthi awekho amathuba angagcwaliseka.

NGESIKHATHI

Kungumsebenzi ophindaphindwayo oqala uhlolisise isimo bese kuthi uma ugcwaliseka wenze uchungechunge lwemiyalo bese uhlaziya kabusha isimo futhi uma kuyiqiniso uphinde wenze imiyalo efanayo futhi uqhubeke kanjena kuze kube yilapho isimo singamanga.

uma isimo singamanga kusukela ekuqaleni asisoze senziwa futhi uma ngaso sonke isikhathi siyiqiniso sizobekwa ku-loop engapheli, ukuze kugwenywe okokugcina emiyalweni kufanele kube nokuthile okuthi ngesikhathi esithile kwenziwe isimo sikhohlise isimo ukuze sikwazi ukuqeda i-loop.

i-syntax yayo yile:

Mientras [condición a evaluar] Hacer
[instrucciones] FinMientras

PHINDA-KUZE KUZE KUKHONA

Lo ngumsebenzi ocishe ufane nowangaphambilini, kepha ngokungafani nowedlule, lo ubheka isimo ekugcineni, okungukuthi, umyalo uzokwenziwa okungenani isikhathi esingu-1, futhi esikhundleni sokwenza umyalo lapho kuyiqiniso, uyawenza ngenkathi Uma isimo singafinyelelwanga, kepha uma ufuna ukuthi senziwe ngenkathi isimo sihlangatshezwa, sebenzisa u- "ngenkathi" esikhundleni sokuthi "kuze kube".

i-syntax yayo yile:

Repetir
[Instrucciones] hasta que [condicion]

IMALI

Lesi sitatimende senza umyalo inani elinqumayo lezikhathi zokuguquguqukayo, ngokungafani nokwedlule, lo mjikelezo ushintsha inani lokuguquguqukayo okukhulunywa ngalo ngokwalo, kanye nokuba ne-syntax enamandla kakhulu.

Para [variable] Desde [valor inicial] Hasta [valor Final] Con [paso] Hacer
[instruciones] FinPara

"Okuguqukayo" okuguquguqukayo okuthola "inani lokuqala" bese kusebenze imiyalo bese kungeza okuthi "okuguquguqukayo" kanye "nesinyathelo" kuphinde kwenziwe imiyalelo futhi kuze kube "okuguquguqukayo" kulingana "inani lokugcina".

uma "nge [sinyathelo]" kususwa lapho ngokuzenzakalela kuzokwazi ukuthi "isinyathelo" silingana no-1, futhi uma [isinyathelo] singacacisiwe futhi "inani lokuqala" likhulu kune "inani lokugcina" lizodlula ngokulandelana okuphambene, okungukuthi, "Isinyathelo" ngu -1

INKQUBO / UMSEBENZI

Intambo noma umsebenzi wuhlelo ngaphakathi kolunye nokuthi le subprogram ithola inani elilodwa noma amaningi, iyasebenza bese ibuyisa elinye. I-syntax yayo ngu

SubProceso [variable_de_retorno]<- [nombre de la funcion] ([arg_1],[arg_2],...,[arg_n])

acción 1;
acción 2;
.
.
.
acción n;
FinSubproceso

lapho "ukubuya okuguqukayo" kungukuguquguquka okuqukethe inani elibuyiswe umsebenzi "wegama lomsebenzi" othole amapharamitha "arg_1, arg_2, arg_n" ukwenza lokhu

EZINYE

Le yimisebenzi encedisana kuphela neminye futhi engenayo i-syntax eyinkimbinkimbi ngoba yimisebenzi ehambisanayo kuphela.

Sula isikrini

Lo msebenzi usula isikrini sanoma iyiphi into kutolika

Linda ukhiye

Lo msebenzi ulinda umsebenzisi ukuthi acindezele ukhiye ukuze aqhubeke nohlelo

Linda x {Okwesibili, amaMilliseconds}

lo msebenzi ulinda isikhathi ngemizuzwana noma ngama-millisecond ukuze uqhubeke nohlelo

PS: ngiyaxolisa ngokubambezeleka kodwa bengimatasa nezinye izindaba ngakho angikwazi ukubhala


Okuqukethwe yi-athikili kunamathela ezimisweni zethu ze izimiso zokuhlelela. Ukubika iphutha chofoza lapha.

Amazwana ayi-10, shiya okwakho

Shiya umbono wakho

Ikheli lakho le ngeke ishicilelwe. Ezidingekayo ibhalwe nge *

*

*

  1. Ubhekele imininingwane: Miguel Ángel Gatón
  2. Inhloso yedatha: Lawula Ugaxekile, ukuphathwa kwamazwana.
  3. Ukusemthethweni: Imvume yakho
  4. Ukuxhumana kwemininingwane: Imininingwane ngeke idluliselwe kubantu besithathu ngaphandle kwesibopho esisemthethweni.
  5. Isitoreji sedatha: Idatabase ebanjwe yi-Occentus Networks (EU)
  6. Amalungelo: Nganoma yisiphi isikhathi ungakhawulela, uthole futhi ususe imininingwane yakho.

  1.   IGuille kusho

    Awunayo imisebenzi yokubamba izinkinobho ngaphandle kokumisa ukwenziwa? Ngokwenza okuthile ngokunyakaza okuheha kakhulu izingane ezineminyaka eyi-9, yize umdlalo we-hangman nawo ungaba mnandi ukuwuhlelela.

    Cubungula okuthile_digo
    a <-1;
    ohlangothini <-30;
    phansi <-5;
    Ngenkathi = 1 Do
    Sula isikrini;
    c <-1;
    umugqa <- "";
    Phinda
    umugqa <-line + "";
    c <-c + 1;
    Kuze kube c = lateral
    umugqa <-line + "X";
    c <-1;
    Phinda
    Ukubhala " ";
    c <-c + 1;
    Kuze kube c = phansi-1
    Bhala umugqa;
    Phinda
    Ukubhala " ";
    c 2 Bese
    phansi <-phansi-1;
    Qeda yebo
    "s":
    Uma ngezansi <15 Ngemuva kwalokho
    phansi 2 Bese
    eceleni <-lateral-1;
    Qeda yebo
    "d":
    Uma lateral <50 Ngemuva kwalokho
    eceleni <-lateral + 1;
    Qeda yebo
    "0":
    a <-2;
    Qeda imizuzwana
    Qeda Ngenkathi
    Inqubo Yokuqeda

  2.   IGuille kusho

    Yebo, yehluleka uma ukhuphuka, shintsha kangcono ulayini 23 no-28
    -23 Kuze kube ngu-c = 15
    + 23 Kuze kube ngu-c = 18
    y
    -28 Uma uphansi> 2 Ngemuva kwalokho
    +28 Uma uphansi> 3 Bese

    1.    xnmm kusho

      Ngiyabonga ngomnikelo kodwa unezinkinga ezifana nokuthi uvula umusho owodwa ngaphakathi komunye kodwa kufanele uphele ngaphakathi komusho lapho uqale khona, ngisho ukuthi, awunakubekwa

      Cubungula okuthile
      a <- 0;
      funda ku;
      uma u-a engalingani no-25 ngaleso sikhathi
      ngenkathi a ayilingani no-0 do
      funda ku;
      Qeda yebo
      phela ngenkathi

      njengoba ubona iluphu ngenkathi uqala ngaphakathi kwesitatimende "uma ngabe" kodwa uphela ngaphandle kwaso, into efana nale ayinakwenzeka.

      Ngisawuthokozela umnikelo
      Inqubo yokuphela

      1.    IGuille kusho

        Ngiyabonga, kepha ngicabanga ukuthi kuyinkinga enkulu ukubeka ikhodi lapha, ukuthi angazi ukuthi ngiyibeka kanjani kuhlobo lwekhodi futhi iphuma ngaphandle kokuqondiswa.

        Uhlelo lusebenza kahle. Okuguquguqukayo "a" Ngimane ngikusebenzisa ukuphuma ku-loop lapho umsebenzisi ethayipha uziro. Ungafaka ukuphuma () noma ikhefu; ngaphansi kwemibandela uyibheka futhi ngigcina okuguqukayo. Ziyizinketho.

        Ukubingelela

      2.    IGuille kusho

        Ngizozama ukushintsha amathebhu ezikhala namalebula por si funciona algo:

        Proceso algo_digo
        a<-1;
        lateral<-30;
        abajo<-5;
        Mientras a=1 Hacer
        Borrar Pantalla;
        c<-1;
        linea<-"";
        Repetir
        linea<-linea+" ";
        c<-c+1;
        Hasta Que c=lateral
        linea<-linea+"X";
        c<-1;
        Repetir
        Escribir " ";
        c<-c+1;
        Hasta Que c=abajo-1
        Escribir linea;
        Repetir
        Escribir " ";
        c 3 Entonces
        abajo<-abajo-1;
        Fin Si
        "s":
        Si abajo < 15 Entonces
        abajo 2 Entonces
        lateral<-lateral-1;
        Fin Si
        "d":
        Si lateral < 50 Entonces
        lateral<-lateral+1;
        Fin Si
        "0":
        a<-2;
        Fin Segun
        Fin Mientras
        FinProceso

      3.    IGuille kusho

        Lokho kugcwele amaphutha wokungenisa avela kukhodi yami, ngizozama futhi ngamathebhu:
        Lokhu kuzoba yifayela algo.psc

        Proceso algo_digo
        a<-1;
        lateral<-30;
        abajo<-5;
        Mientras a=1 Hacer
        Borrar Pantalla;
        c<-1;
        linea<-"";
        Repetir
        linea<-linea+" ";
        c<-c+1;
        Hasta Que c=lateral
        linea<-linea+"X";
        c<-1;
        Repetir
        Escribir " ";
        c<-c+1;
        Hasta Que c=abajo-1
        Escribir linea;
        Repetir
        Escribir " ";
        c 3 Entonces
        abajo<-abajo-1;
        Fin Si
        "s":
        Si abajo < 15 Entonces
        abajo 2 Entonces
        lateral<-lateral-1;
        Fin Si
        "d":
        Si lateral < 50 Entonces
        lateral<-lateral+1;
        Fin Si
        "0":
        a<-2;
        Fin Segun
        Fin Mientras
        FinProceso

      4.    IGuille kusho

        Kuyathakazelisa ukuthi ukuphawula okunamalebula ekhodi kuyadliwa, kuyasuswa, noma yini engena phakathi, ngokwesibonelo phakathi kwemigqa
        Phinda
        Ukubhala " ";
        c
        ngemuva c kukhona i
        bese-ke kuqhubeka ngo-3 Bese
        phansi
        Kukonke, lokhu akunakwethenjelwa ukukubeka ngokuya ngamakhodi.

  3.   IGuille kusho

    Ngiguqula izimpawu zisuka ekunikezeni ziye = ukubona ukuthi kanjani.

    Proceso algo_digo
    a=1;
    lateral=30;
    abajo=5;
    Mientras a=1 Hacer
    Borrar Pantalla;
    c=1;
    linea="";
    Repetir
    linea=linea+" ";
    c=c+1;
    Hasta Que c=lateral
    linea=linea+"X";
    c=1;
    Repetir
    Escribir " ";
    c=c+1;
    Hasta Que c=abajo-1
    Escribir linea;
    Repetir
    Escribir " ";
    c=c+1;
    Hasta Que c=18
    Escribir "Dibujo una X (w,a,s,d y 0 para salir)";
    Leer mueve;
    Segun mueve Hacer
    "w":
    Si abajo > 3 Entonces
    abajo=abajo-1;
    Fin Si
    "s":
    Si abajo 2 Entonces
    lateral=lateral-1;
    Fin Si
    "d":
    Si lateral < 50 Entonces
    lateral=lateral+1;
    Fin Si
    "0":
    a=2;
    Fin Segun
    Fin Mientras
    FinProceso

    1.    IGuille kusho

      Igcina idla ingxenye yekhodi, ithegi yekhodi yehluleka, kufanele ishiye ukubhala njengoba kunjalo.

      1.    xnmm kusho

        Sawubona ngiyaxolisa ngokungakuboni uphendule ngaphambilini kodwa kahle
        ngoba awukwazi ukushicilela ikhodi kahle ngoba awuyithumeli kimi ngeposi ngakho-ke awunikeli ithuba eliningi kulolu daba.