Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":13735,"date":"2015-05-05T19:30:19","date_gmt":"2015-05-06T00:30:19","guid":{"rendered":"https:\/\/oswaldouliel.withknown.com\/2015\/use-of-loops-with-while---mastery-19"},"modified":"2015-05-05T19:30:19","modified_gmt":"2015-05-06T00:30:19","slug":"use-of-loops-with-while-mastery-19-2","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2015\/2015\/use-of-loops-with-while-mastery-19-2\/","title":{"rendered":"Use of loops with \u201cwhile\u201d – Mastery 19"},"content":{"rendered":"
\n

Como usar un\u00a0loop con “while”<\/p>\n

Antes de empezar tenemos que saber que es un loop; es una serie de acciones que se repiten en este caso, con ayuda del while, las instrucciones dentro del loop van a repetirse mientras algo este pasando, como en el siguiente ejemplo:<\/p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
#include<\/a> <\/iostream><\/td>\n<\/tr>\n
\u00a0<\/td>\n#include<\/a> <\/cstdlib><\/td>\n<\/tr>\n
\u00a0<\/td>\n#include<\/a> <\/time.h><\/td>\n<\/tr>\n
\u00a0<\/td>\n\u00a0<\/td>\n<\/tr>\n
\u00a0<\/td>\nusing namespace std;<\/td>\n<\/tr>\n
\u00a0<\/td>\n\u00a0<\/td>\n<\/tr>\n
\u00a0<\/td>\nint main()<\/td>\n<\/tr>\n
\u00a0<\/td>\n{<\/td>\n<\/tr>\n
\u00a0<\/td>\nint sec, num, cont =0;<\/td>\n<\/tr>\n
\u00a0<\/td>\nsrand(time(NULL));<\/td>\n<\/tr>\n
\u00a0<\/td>\nsec = rand()%100+1;<\/td>\n<\/tr>\n
\u00a0<\/td>\n\u00a0<\/td>\n<\/tr>\n
\u00a0<\/td>\nwhile(num != sec){<\/td>\n<\/tr>\n
\u00a0<\/td>\ncout\n<\/td>\n<\/tr>\n
\u00a0<\/td>\ncin >> num;<\/td>\n<\/tr>\n
\u00a0<\/td>\n\u00a0<\/td>\n<\/tr>\n
\u00a0<\/td>\nif (num > sec){<\/td>\n<\/tr>\n
\u00a0<\/td>\ncout\n<\/td>\n<\/tr>\n
\u00a0<\/td>\n}<\/td>\n<\/tr>\n
\u00a0<\/td>\nif (num\n<\/td>\n<\/tr>\n
\u00a0<\/td>\ncout\n<\/td>\n<\/tr>\n
\u00a0<\/td>\n}<\/td>\n<\/tr>\n
\u00a0<\/td>\ncont++;<\/td>\n<\/tr>\n
\u00a0<\/td>\n}<\/td>\n<\/tr>\n
\u00a0<\/td>\n\u00a0<\/td>\n<\/tr>\n
\u00a0<\/td>\ncout\n<\/td>\n<\/tr>\n
\u00a0<\/td>\ncout\n<\/td>\n<\/tr>\n
\u00a0<\/td>\n\u00a0<\/td>\n<\/tr>\n
\u00a0<\/td>\nreturn 0;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u00a0<\/p>\n

En el ejempo anterior\u00a0existe un loop con while, este nos indica que mientras la condicional sea false, todo el loop va a repetirse, pero si el usuario ingresa un numero correcto que para nuestro codigo seria el 42, la variable\u00a0num seria true, por lo que la condicion del while ya no se cumple y el loop se saldria y el programa continuaria corriendo.<\/span><\/p>\n

#TC<\/a>1017 #Mastery<\/a>19<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"

\n

Como usar un loop con “while”<\/p>\n

Antes de empezar tenemos que saber que es un loop; es una serie de acciones que se repiten en este caso, con ayuda del while, las instrucciones dentro del loop van a repetirse mientras algo este pasando, como en el siguiente ejemplo:<\/p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
#include<\/a> <\/td>\n<\/tr>\n
 <\/td>\n#include<\/a> <\/td>\n<\/tr>\n
 <\/td>\n#include<\/a> <\/td>\n<\/tr>\n
 <\/td>\n <\/td>\n<\/tr>\n
 <\/td>\nusing namespace std;<\/td>\n<\/tr>\n
 <\/td>\n <\/td>\n<\/tr>\n
 <\/td>\nint main()<\/td>\n<\/tr>\n
 <\/td>\n{<\/td>\n<\/tr>\n
 <\/td>\nint sec, num, cont =0;<\/td>\n<\/tr>\n
 <\/td>\nsrand(time(NULL));<\/td>\n<\/tr>\n
 <\/td>\nsec = rand()%100+1;<\/td>\n<\/tr>\n
 <\/td>\n <\/td>\n<\/tr>\n
 <\/td>\nwhile(num != sec){<\/td>\n<\/tr>\n
 <\/td>\ncout\n<\/td>\n<\/tr>\n
 <\/td>\ncin >> num;<\/td>\n<\/tr>\n
 <\/td>\n <\/td>\n<\/tr>\n
 <\/td>\nif (num > sec){<\/td>\n<\/tr>\n
 <\/td>\ncout\n<\/td>\n<\/tr>\n
 <\/td>\n}<\/td>\n<\/tr>\n
 <\/td>\nif (num\n<\/td>\n<\/tr>\n
 <\/td>\ncout\n<\/td>\n<\/tr>\n
 <\/td>\n}<\/td>\n<\/tr>\n
 <\/td>\ncont++;<\/td>\n<\/tr>\n
 <\/td>\n}<\/td>\n<\/tr>\n
 <\/td>\n <\/td>\n<\/tr>\n
 <\/td>\ncout\n<\/td>\n<\/tr>\n
 <\/td>\ncout\n<\/td>\n<\/tr>\n
 <\/td>\n <\/td>\n<\/tr>\n
 <\/td>\nreturn 0;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

 <\/p>\n

En el ejempo anterior existe un loop con while, este nos indica que mientras la condicional sea false, todo el loop va a repetirse, pero si el usuario ingresa un numero correcto que para nuestro codigo seria el 42, la variable num seria true, por lo que la condicion del while ya no se cumple y el loop se saldria y el programa continuaria corriendo.<\/span><\/p>\n

#TC<\/a>1017 #Mastery<\/a>19<\/p>\n<\/div>\n

Continue reading →<\/span><\/a><\/p>\n","protected":false},"author":101,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3,26],"tags":[144,213,95,115,486,40,287],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/13735"}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/users\/101"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/comments?post=13735"}],"version-history":[{"count":1,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/13735\/revisions"}],"predecessor-version":[{"id":13736,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/13735\/revisions\/13736"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/media?parent=13735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/categories?post=13735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/tags?post=13735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}