Yuav Tsim Cov Ntaub Ntawv Pascal Li Cas

Cov txheej txheem:

Yuav Tsim Cov Ntaub Ntawv Pascal Li Cas
Yuav Tsim Cov Ntaub Ntawv Pascal Li Cas

Video: Yuav Tsim Cov Ntaub Ntawv Pascal Li Cas

Video: Yuav Tsim Cov Ntaub Ntawv Pascal Li Cas
Video: Qhia tawm laug hais paj ntaub cog ci By Pakou Her 2024, Hlis ntuj nqeg
Anonim

Pascal yog ib qho ntawm feem ntau siv lus programming vim nws yooj yim thiab muaj nuj nqi. Los ntawm Pascal, koj tuaj yeem ua haujlwm nrog cov ntaub ntawv los ntawm kev tsim lossis kho lawv los ntawm kev siv haujlwm kom tsim nyog.

Yuav tsim cov ntaub ntawv pascal li cas
Yuav tsim cov ntaub ntawv pascal li cas

Cov Lus Qhia

Kauj ruam 1

Txhawm rau tsim cov ntawv sau hauv Pascal, nws yog qhov tsim nyog los tsim cov kev hloov pauv ntawm hom tsim nyog, uas yuav raug sau mus rau ntu ntu kev cim. Txhawm rau ua qhov no, koj tuaj yeem siv ntau txoj haujlwm ntawm hom lus. Txhua cov ntaub ntawv thiab hloov pauv tau sau siv qhov qauv Writeln kev ua haujlwm (tsuas yog qhia meej ntxiv kev ntsuas).

var textfile: Ntawv; nametype: Hlua; textstring: Txoj hlua; a, b: integer; Qhov twg textfile yog qhov sib txawv ntawm cov Hom Ntawv uas muaj lub npe ntawm cov ntawv. Nametype - hom ntawv sau nkag rau cov hlua uas tau muab rau. Textstring yog ib txoj hlua kab ntawm yam tsim nyog. A thiab b yog cov hloov kom hloov uas sau tus lej ua lej.

Kauj ruam 2

Qhia tus neeg siv kom nkag mus rau hauv cov hom ntaub ntawv xav tau nametype. Nws yuav tsum txuas nrog rau textfile. Writeln nws tus kheej ('Thov, ntaus lub npe ntawm cov ntaub ntawv ntaus');

Readln (nametype);

Muab ua (textfile, nametype);

Kauj ruam 3

Qhib cov ntawv kom sau cov ntaub ntawv thiab kom tus neeg siv kom nkag mus ua ntej tus naj npawb ntawm kab sau, thiab tom qab ntawd lawv cov ntsiab lus. Cov ntaub ntawv yuav raug ntaus rau hauv cov ntaub ntawv nws tus kheej ib qho ntawm ib qho. Sau dua tshiab (textfile);

Writeln ('Cov lej ntawm cov hlua:');

Readln (b); {kuj sib txawv uas cia tus naj npawb ntawm kab}

Writeln ('Thov, ntaus cov hlua:');

Kauj ruam 4

Txhawm rau sau cov xov tooj ruaj khov, siv lub voj, thawj tus lej ntawm cov uas yuav tsum sib haum nrog tus lej ntawm thawj kab ntawv ntawm cov ntawv, nyob rau hauv rooj plaub no tus lej 1. rau a: = 1 rau b ua

pib

Readln (ntawv xov xwm);

Writeln (textfile, textstring); {daim ntawv sau muaj nuj nqi}

xaus;

Kauj ruam 5

Tawm hauv cov ntaub ntawv thiab xaus qhov program siv qhov haujlwm zoo. Tsis tas li ntawd tso tawm cov lus ceeb toom txog qhov kev ua tiav zoo. Txhawm rau kom tsis txhob muaj teeb meem nrog cov zis, teeb tsa lub thib ob readln.close (textfile);

Writeln ('Ua tiav');

nyeem;

Xaus.

Kauj Ruam 6

Cov ntaub ntawv tau tsim zoo. Sib sau thiab khaws tsab ntawv los ntawm cov ntawv qhia zaub mov ntawm koj qhov chaw ib puag ncig.

Pom zoo: