Comparing Selections and Loops
+12
Ferre
ellariana
Rhei
Lawrence
Pox
iramae
Louise Sebastiane Yagi
justjoking10
myramonique
Sean
James Navarro
daniella
16 posters
Page 1 of 2 • 1, 2
Comparing Selections and Loops
Fri Jul 27, 2018 9:22 am
An important difference between a selection and a loop is that in the selection structure, the two logical paths that emerge from the decision join together following their actions. In the loop structure, the paths that emerge from the decision do not join together. Instead, with a loop, one of the logical branches that emerges from the structure-controlling decision eventually returns to the same decision.
For example, suppose your supervisor says, “If you don’t reach the end of the file when you are reading an employee record, display the record and read another one. Keep doing this until you run out of records.” Because the supervisor used the word if to startthe request, your first inclination might be to create logic that looks like Figure below.
Inefficient logic for reading and displaying employee records
The logic in Figure above works—each time an employee record is input and the eof condition is not met, the data is displayed and another record is input. However, the logic in Figure is flawed. First, if you do not know how many input records there are , the logic might never end. After each record is input, it is always necessary to check again for the eof condition. Second, even if you do know the number of input records, the logic becomes very unwieldy after three or four records. When you examine Figure , you see that the same set of steps is repeated. Actions that are repeated
are best handled in a loop.
The Figure BELOW shows a better solution to the problem.
The first employee record is input, and as long as the eof condition is not met, the program continuously displays and reads additional records.
Efficient and structured logic for getting and displaying employee records
For example, suppose your supervisor says, “If you don’t reach the end of the file when you are reading an employee record, display the record and read another one. Keep doing this until you run out of records.” Because the supervisor used the word if to startthe request, your first inclination might be to create logic that looks like Figure below.
Inefficient logic for reading and displaying employee records
The logic in Figure above works—each time an employee record is input and the eof condition is not met, the data is displayed and another record is input. However, the logic in Figure is flawed. First, if you do not know how many input records there are , the logic might never end. After each record is input, it is always necessary to check again for the eof condition. Second, even if you do know the number of input records, the logic becomes very unwieldy after three or four records. When you examine Figure , you see that the same set of steps is repeated. Actions that are repeated
are best handled in a loop.
The Figure BELOW shows a better solution to the problem.
The first employee record is input, and as long as the eof condition is not met, the program continuously displays and reads additional records.
Efficient and structured logic for getting and displaying employee records
- James NavarroGuru
- Posts : 12
Join date : 2018-07-31
Re: Comparing Selections and Loops
Tue Jul 31, 2018 7:21 pm
Kumplikado na ng very light mga topics pero kinakaya pa naman hahaha, dito da topic na to mam naguguluhan nung isang araw pero thank you po dahil sa pagpost lessons dito mas nagets ko
Sent from Topic'it App
Sent from Topic'it App
- SeanGuru
- Posts : 15
Join date : 2018-07-27
Re: Comparing Selections and Loops
Tue Jul 31, 2018 9:58 pm
may mga loop talaga na di natin alam na may mas maikli pa palang way .
Sent from Topic'it App
Sent from Topic'it App
- myramoniqueGuru
- Posts : 11
Join date : 2018-08-01
Re: Comparing Selections and Loops
Wed Aug 01, 2018 4:49 pm
Salamat ma'am! Kasi po nagagamit po namin yung forum na 'to as a guide para po mas mapalawak pa po namin yung kaalaman namin sa topic niyo.
Sent from Topic'it App
Sent from Topic'it App
- justjoking10Guru
- Posts : 25
Join date : 2018-08-01
Re: Comparing Selections and Loops
Wed Aug 01, 2018 7:17 pm
Maam ang ganda po ng pag kaka explain very clear and very understandable. We just need to be careful about s nesting maam.
Re: Comparing Selections and Loops
Thu Aug 02, 2018 8:58 am
Sean wrote:may mga loop talaga na di natin alam na may mas maikli pa palang way .
Sent from Topic'it App
LOOPS are the BEST to REPETITIVE TASK, when ang nag iiba lang ay data
Re: Comparing Selections and Loops
Thu Aug 02, 2018 8:59 am
justjoking10 wrote:Maam ang ganda po ng pag kaka explain very clear and very understandable. We just need to be careful about s nesting maam.
explain sa forum or discussion natin ? haha Careful , dapat observe talaga ang Loop Control Variable )
Re: Comparing Selections and Loops
Thu Aug 02, 2018 9:00 am
justjoking10 wrote:Maam ang ganda po ng pag kaka explain very clear and very understandable. We just need to be careful about s nesting maam.
yey! Thanks to Forumotion
- Louise Sebastiane YagiGuru
- Posts : 19
Join date : 2018-07-27
Re: Comparing Selections and Loops
Thu Aug 02, 2018 6:00 pm
Ma’am possible po ba sa if and sa else, parehong may loop?
Sent from Topic'it App
Sent from Topic'it App
- justjoking10Guru
- Posts : 25
Join date : 2018-08-01
Re: Comparing Selections and Loops
Thu Aug 02, 2018 7:19 pm
Louise Sebastiane Yagi wrote:Ma’am possible po ba sa if and sa else, parehong may loop?
Sent from Topic'it App
Pwede. If hinihingi ng problem mo.
- iramaeGuru
- Posts : 10
Join date : 2018-08-01
Re: Comparing Selections and Loops
Wed Aug 08, 2018 7:52 am
Sean wrote:may mga loop talaga na di natin alam na may mas maikli pa palang way .
Sent from Topic'it App
at kung malalaman niyo yung loop na iba ba, mas maganda ang program na magagawa ninyo.
- iramaeGuru
- Posts : 10
Join date : 2018-08-01
Re: Comparing Selections and Loops
Wed Aug 08, 2018 7:52 am
Good luck to Maam Daniella sa susunod pang discussion XD sana magawa na naten ng maayos XD GodBless
- James NavarroGuru
- Posts : 12
Join date : 2018-07-31
Re: Comparing Selections and Loops
Sat Aug 11, 2018 7:52 am
Maayos naman po maam pagkakadiscuss nyo po Galing nyo nga po magexplain e hahaha
Sent from Topic'it App
Sent from Topic'it App
- James NavarroGuru
- Posts : 12
Join date : 2018-07-31
Re: Comparing Selections and Loops
Sat Aug 11, 2018 7:52 am
Nakakakaba next lesson hahahaha
Sent from Topic'it App
Sent from Topic'it App
- James NavarroGuru
- Posts : 12
Join date : 2018-07-31
Re: Comparing Selections and Loops
Sat Aug 11, 2018 2:53 pm
daniella wrote:justjoking10 wrote:Maam ang ganda po ng pag kaka explain very clear and very understandable. We just need to be careful about s nesting maam.
explain sa forum or discussion natin ? haha [smiley]https://2img.net/i/fa/i/smiles/icon_lol.gif[/smiley] Careful , dapat observe talaga ang Loop Control Variable [smiley]https://2img.net/i/fa/i/smiles/icon_smile.gif[/smiley])
Both yan maam hahahaha galing nyo po magturo
Sent from Topic'it App
- PoxGuru
- Posts : 11
Join date : 2018-08-11
Re: Comparing Selections and Loops
Sat Aug 11, 2018 6:33 pm
Structure pa rin po ba kahit wala ng boolean expression sa program?
Sent from Topic'it App
Sent from Topic'it App
- LawrenceGuru
- Posts : 11
Join date : 2018-08-11
Re: Comparing Selections and Loops
Sat Aug 11, 2018 7:09 pm
possible siya pre. kapag sa if decision mo kailangan ng loop kapag na meet na yung condition mo sa decision.Louise Sebastiane Yagi wrote:Ma’am possible po ba sa if and sa else, parehong may loop?
Sent from Topic'it App
- LawrenceGuru
- Posts : 11
Join date : 2018-08-11
Re: Comparing Selections and Loops
Sat Aug 11, 2018 7:10 pm
pre pwede maging structured pag flowchart yung ginawa kaso walang patutunguhan. hahahaahha opinyon ko lang ehhePox wrote:Structure pa rin po ba kahit wala ng boolean expression sa program?
Sent from Topic'it App
- RheiGuru
- Posts : 11
Join date : 2018-07-28
Re: Comparing Selections and Loops
Thu Aug 16, 2018 10:20 am
Suggestion ko lang po, sana sa susunod po sana mas marami na pong example. tapos wala na po munang MASYADONG magtatanong HAHAHAHHAHA
Sorry Jungkook Peacee!
Sorry Jungkook Peacee!
- RheiGuru
- Posts : 11
Join date : 2018-07-28
Re: Comparing Selections and Loops
Thu Aug 16, 2018 10:22 am
Oo pre as long as structured yung program. wag ka munang mag spagetti code.justjoking10 wrote:Louise Sebastiane Yagi wrote:Ma’am possible po ba sa if and sa else, parehong may loop?
Sent from Topic'it App
Pwede. If hinihingi ng problem mo.
- RheiGuru
- Posts : 11
Join date : 2018-07-28
Re: Comparing Selections and Loops
Thu Aug 16, 2018 10:23 am
yah! yah! yah!Sean wrote:may mga loop talaga na di natin alam na may mas maikli pa palang way .
Sent from Topic'it App
- RheiGuru
- Posts : 11
Join date : 2018-07-28
Re: Comparing Selections and Loops
Thu Aug 16, 2018 10:26 am
justjoking10 wrote:Louise Sebastiane Yagi wrote:Ma’am possible po ba sa if and sa else, parehong may loop?
Sent from Topic'it App
Pwede. If hinihingi ng problem mo.
anyone please give an example
- RheiGuru
- Posts : 11
Join date : 2018-07-28
Re: Comparing Selections and Loops
Thu Aug 16, 2018 10:28 am
Lawrence wrote:pre pwede maging structured pag flowchart yung ginawa kaso walang patutunguhan. hahahaahha opinyon ko lang ehhePox wrote:Structure pa rin po ba kahit wala ng boolean expression sa program?
Sent from Topic'it App
para sa akin bawal. kasi kailangan ng boolean example
- ellarianaGuru
- Posts : 10
Join date : 2018-08-16
Re: Comparing Selections and Loops
Thu Aug 16, 2018 10:29 am
mam examples pa po please
- RheiGuru
- Posts : 11
Join date : 2018-07-28
Re: Comparing Selections and Loops
Thu Aug 16, 2018 10:32 am
oo nga ei, lalo na pag ipapakita na nila maam yung mga flowchart. tapos next meeting, quiz agad. SKLJames Navarro wrote:Nakakakaba next lesson hahahaha
Sent from Topic'it App
Page 1 of 2 • 1, 2
Permissions in this forum:
You cannot reply to topics in this forum
|
|