Mon Oct 7 16:58:39 2024
EVENTS
 FREE
SOFTWARE
INSTITUTE

POLITICS
JOBS
MEMBERS'
CORNER

MAILING
LIST

NYLXS Mailing Lists and Archives
NYLXS Members have a lot to say and share but we don't keep many secrets. Join the Hangout Mailing List and say your peice.

DATE 2010-03-01

HANGOUT

2024-10-07 | 2024-09-07 | 2024-08-07 | 2024-07-07 | 2024-06-07 | 2024-05-07 | 2024-04-07 | 2024-03-07 | 2024-02-07 | 2024-01-07 | 2023-12-07 | 2023-11-07 | 2023-10-07 | 2023-09-07 | 2023-08-07 | 2023-07-07 | 2023-06-07 | 2023-05-07 | 2023-04-07 | 2023-03-07 | 2023-02-07 | 2023-01-07 | 2022-12-07 | 2022-11-07 | 2022-10-07 | 2022-09-07 | 2022-08-07 | 2022-07-07 | 2022-06-07 | 2022-05-07 | 2022-04-07 | 2022-03-07 | 2022-02-07 | 2022-01-07 | 2021-12-07 | 2021-11-07 | 2021-10-07 | 2021-09-07 | 2021-08-07 | 2021-07-07 | 2021-06-07 | 2021-05-07 | 2021-04-07 | 2021-03-07 | 2021-02-07 | 2021-01-07 | 2020-12-07 | 2020-11-07 | 2020-10-07 | 2020-09-07 | 2020-08-07 | 2020-07-07 | 2020-06-07 | 2020-05-07 | 2020-04-07 | 2020-03-07 | 2020-02-07 | 2020-01-07 | 2019-12-07 | 2019-11-07 | 2019-10-07 | 2019-09-07 | 2019-08-07 | 2019-07-07 | 2019-06-07 | 2019-05-07 | 2019-04-07 | 2019-03-07 | 2019-02-07 | 2019-01-07 | 2018-12-07 | 2018-11-07 | 2018-10-07 | 2018-09-07 | 2018-08-07 | 2018-07-07 | 2018-06-07 | 2018-05-07 | 2018-04-07 | 2018-03-07 | 2018-02-07 | 2018-01-07 | 2017-12-07 | 2017-11-07 | 2017-10-07 | 2017-09-07 | 2017-08-07 | 2017-07-07 | 2017-06-07 | 2017-05-07 | 2017-04-07 | 2017-03-07 | 2017-02-07 | 2017-01-07 | 2016-12-07 | 2016-11-07 | 2016-10-07 | 2016-09-07 | 2016-08-07 | 2016-07-07 | 2016-06-07 | 2016-05-07 | 2016-04-07 | 2016-03-07 | 2016-02-07 | 2016-01-07 | 2015-12-07 | 2015-11-07 | 2015-10-07 | 2015-09-07 | 2015-08-07 | 2015-07-07 | 2015-06-07 | 2015-05-07 | 2015-04-07 | 2015-03-07 | 2015-02-07 | 2015-01-07 | 2014-12-07 | 2014-11-07 | 2014-10-07 | 2014-09-07 | 2014-08-07 | 2014-07-07 | 2014-06-07 | 2014-05-07 | 2014-04-07 | 2014-03-07 | 2014-02-07 | 2014-01-07 | 2013-12-07 | 2013-11-07 | 2013-10-07 | 2013-09-07 | 2013-08-07 | 2013-07-07 | 2013-06-07 | 2013-05-07 | 2013-04-07 | 2013-03-07 | 2013-02-07 | 2013-01-07 | 2012-12-07 | 2012-11-07 | 2012-10-07 | 2012-09-07 | 2012-08-07 | 2012-07-07 | 2012-06-07 | 2012-05-07 | 2012-04-07 | 2012-03-07 | 2012-02-07 | 2012-01-07 | 2011-12-07 | 2011-11-07 | 2011-10-07 | 2011-09-07 | 2011-08-07 | 2011-07-07 | 2011-06-07 | 2011-05-07 | 2011-04-07 | 2011-03-07 | 2011-02-07 | 2011-01-07 | 2010-12-07 | 2010-11-07 | 2010-10-07 | 2010-09-07 | 2010-08-07 | 2010-07-07 | 2010-06-07 | 2010-05-07 | 2010-04-07 | 2010-03-07 | 2010-02-07 | 2010-01-07 | 2009-12-07 | 2009-11-07 | 2009-10-07 | 2009-09-07 | 2009-08-07 | 2009-07-07 | 2009-06-07 | 2009-05-07 | 2009-04-07 | 2009-03-07 | 2009-02-07 | 2009-01-07 | 2008-12-07 | 2008-11-07 | 2008-10-07 | 2008-09-07 | 2008-08-07 | 2008-07-07 | 2008-06-07 | 2008-05-07 | 2008-04-07 | 2008-03-07 | 2008-02-07 | 2008-01-07 | 2007-12-07 | 2007-11-07 | 2007-10-07 | 2007-09-07 | 2007-08-07 | 2007-07-07 | 2007-06-07 | 2007-05-07 | 2007-04-07 | 2007-03-07 | 2007-02-07 | 2007-01-07 | 2006-12-07 | 2006-11-07 | 2006-10-07 | 2006-09-07 | 2006-08-07 | 2006-07-07 | 2006-06-07 | 2006-05-07 | 2006-04-07 | 2006-03-07 | 2006-02-07 | 2006-01-07 | 2005-12-07 | 2005-11-07 | 2005-10-07 | 2005-09-07 | 2005-08-07 | 2005-07-07 | 2005-06-07 | 2005-05-07 | 2005-04-07 | 2005-03-07 | 2005-02-07 | 2005-01-07 | 2004-12-07 | 2004-11-07 | 2004-10-07 | 2004-09-07 | 2004-08-07 | 2004-07-07 | 2004-06-07 | 2004-05-07 | 2004-04-07 | 2004-03-07 | 2004-02-07 | 2004-01-07 | 2003-12-07 | 2003-11-07 | 2003-10-07 | 2003-09-07 | 2003-08-07 | 2003-07-07 | 2003-06-07 | 2003-05-07 | 2003-04-07 | 2003-03-07 | 2003-02-07 | 2003-01-07 | 2002-12-07 | 2002-11-07 | 2002-10-07 | 2002-09-07 | 2002-08-07 | 2002-07-07 | 2002-06-07 | 2002-05-07 | 2002-04-07 | 2002-03-07 | 2002-02-07 | 2002-01-07 | 2001-12-07 | 2001-11-07 | 2001-10-07 | 2001-09-07 | 2001-08-07 | 2001-07-07 | 2001-06-07 | 2001-05-07 | 2001-04-07 | 2001-03-07 | 2001-02-07 | 2001-01-07 | 2000-12-07 | 2000-11-07 | 2000-10-07 | 2000-09-07 | 2000-08-07 | 2000-07-07 | 2000-06-07 | 2000-05-07 | 2000-04-07 | 2000-03-07 | 2000-02-07 | 2000-01-07 | 1999-12-07

Key: Value:

Key: Value:

MESSAGE
DATE 2010-03-16
FROM Ruben Safir
SUBJECT Subject: [NYLXS - HANGOUT] C++ Workshop _ Syntax Basic: Flow Control Structures


In addditon to loops, C++ allows for conditional forks. The keywords
"if" and "else" allow for complex decision making trees on condition.
The general syntax is as follows:

if (conditional statement){
block statements;
block statements;
block statements;
}else{
block statements;
block statements;
block statements;

}


"if"s and "else"s can also be combined into a further compound statement:

if (condition){
block statements;
block statements;
block statements;
}else if(condition){
block statements;
block statements;
block statements;
}else{
block statements;
block statements;
block statements;
}

This is what I would call a closed logical contruction. One of the
must be true. YOu can have an open logic construction as well, but
then it is up to you to control the outcome


if (condition){
block statements;
block statements;
block statements;
}
if (condition 2){
block statements;
block statements;
block statements;
}
if (condition 3){
block statements;
block statements;
block statements;
}


In order to help you control your loops, C++ gives you two keywords to
stop and start loops: break and continue

break: The break statement stops the nearest enclosing loop or switch
statement (we'll look at the switch statement in a moment). Once you
use a break then the loop end and program control continues with the
first statement after the loops curly braces.

continue: continue ends the current iteration in a loop and then
reevaluates the condition and continues within the loop.

The program demonstrates the break and continue statements. It is
a very rough clock which counts down some "event". The unix
enviromental variable ALERT is accessed and evaluated. If it is
equal to "WAIT", the countdown is held. If it is STOP, the countdown
is ended.

To make this work and to test it you have to add the variable in your
shell and export it

ALERT="GO"
export ALERT
set|grep ALERT

-----------------------------------------------------------------------

#include
#include
#include
#include

using namespace std;

int main( int argc, char * argv[]){

//count like a clock
//
int sec = 59;
int min = 59;
int hour = 24;
int breakflag = 0;

cout << "Countdown: Time " << hour << ":" << min << ":" << sec << endl;
while(hour >= 0){
if (min < 0){
min = 59;
}
while(min >= 0){
if (sec < 0){
sec = 59;
}
while (sec >= 0){
cout << "Time " << hour << ":" << min << ":" << sec << endl;

if(char * alert = getenv("ALERT")){

if(strncmp(alert,"WAIT", 10) == 0){
sleep(1);
continue;
}
if(strncmp(alert,"STOP", 10) == 0){
cout << "Count Down Aborted\n";
breakflag=1;
break;
}
}
if(breakflag == 1)
break;
sec--;

sleep(1);
}
if(breakflag == 1)
break;
min--;
// cout << "min\n";
}
if(breakflag == 1)
break;
hour--;
// cout << "hour\n";
}
}



  1. 2010-03-01 Paul Robert Marino <prmarino1-at-gmail.com> Re: [NYLXS - HANGOUT] this should not get through
  2. 2010-03-01 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Catching the streams from Flash Video
  3. 2010-03-02 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: [jim-at-well.com: [conspire] open source
  4. 2010-03-02 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Phone Tech Wars
  5. 2010-03-02 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Workshop / Hacking Society (Smalltalk, C++, Python) Tuesday March 2 6:00PM-8:00PM
  6. 2010-03-02 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] this should not get through
  7. 2010-03-02 Paul Robert Marino <prmarino1-at-gmail.com> Re: [NYLXS - HANGOUT] this should not get through
  8. 2010-03-02 Paul Robert Marino <prmarino1-at-gmail.com> Re: [NYLXS - HANGOUT] this should not get through
  9. 2010-03-03 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] C++ Workshop _ Syntax Basics - agregate data types
  10. 2010-03-03 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop _ Syntax Basics - agregate data
  11. 2010-03-03 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] C++ Workshop _ Syntax Basics - agregate data
  12. 2010-03-04 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] C++ Workshop _ Syntax Basics
  13. 2010-03-05 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop _ Syntax Basics
  14. 2010-03-05 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] AlphaOne Labs invited you to the event "Ask-a-Sysadmin
  15. 2010-03-06 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Professors Open Source Summer Experience -at-RIT
  16. 2010-03-07 Kevin Mark <kevin.mark-at-verizon.net> Re: [NYLXS - HANGOUT] Professors Open Source Summer Experience -at-RIT
  17. 2010-03-09 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] C++ Workshop _ Syntax Basics Structs Unions and
  18. 2010-03-09 From: "Beau Gould" <bg-at-capitalmarketsp.com> Subject: [NYLXS - HANGOUT] [JOB] System Administrator, NYC to 90k
  19. 2010-03-09 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] [JOB] System Administrator, NYC to 90k
  20. 2010-03-10 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop _ Syntax Basics Structs Unions
  21. 2010-03-13 redpill <redpill-at-rcn.com> Subject: [NYLXS - HANGOUT] NYLXS Library?
  22. 2010-03-13 redpill <redpill-at-rcn.com> Subject: [NYLXS - HANGOUT] NYLXS Library?
  23. 2010-03-14 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  24. 2010-03-14 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  25. 2010-03-15 redpill <redpill-at-rcn.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  26. 2010-03-15 redpill <redpill-at-rcn.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  27. 2010-03-15 Contrarian <adrba-at-nyct.net> Re: [NYLXS - HANGOUT] NYLXS Library?
  28. 2010-03-15 Contrarian <adrba-at-nyct.net> Re: [NYLXS - HANGOUT] NYLXS Library?
  29. 2010-03-15 Contrarian <adrba-at-nyct.net> Re: [NYLXS - HANGOUT] NYLXS Library?
  30. 2010-03-15 Contrarian <adrba-at-nyct.net> Re: [NYLXS - HANGOUT] NYLXS Library?
  31. 2010-03-15 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  32. 2010-03-15 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  33. 2010-03-15 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  34. 2010-03-16 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] C++ Workshop _ Syntax Basic: Flow Control Structures
  35. 2010-03-16 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Workshop / Hacking Society (Smalltalk, C++, Python) Tuesday March 16 6:00PM-8:00PM
  36. 2010-03-16 redpill <redpill-at-rcn.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  37. 2010-03-16 redpill <redpill-at-rcn.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  38. 2010-03-17 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] C++ Workshop - Switches and Break
  39. 2010-03-17 einker <eminker-at-gmail.com> Subject: [NYLXS - HANGOUT] Revolution OS at Darress Theatre
  40. 2010-03-20 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] Free Software Round Table TONIGHT at 10PM (live streaming)
  41. 2010-03-21 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] C++ Workshop - Syntax Basics -- functions
  42. 2010-03-21 Kevin Mark <kevin.mark-at-verizon.net> Re: [NYLXS - HANGOUT] C++ Workshop - Syntax Basics -- functions
  43. 2010-03-21 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - Syntax Basics -- functions
  44. 2010-03-21 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - Syntax Basics -- functions
  45. 2010-03-21 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  46. 2010-03-21 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  47. 2010-03-21 Kevin Mark <kevin.mark-at-verizon.net> Re: [NYLXS - HANGOUT] C++ Workshop - Syntax Basics -- functions
  48. 2010-03-21 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - Syntax Basics -- functions
  49. 2010-03-21 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Tina Gasperson commented on Darin Gasperson's status...
  50. 2010-03-21 redpill <redpill-at-rcn.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  51. 2010-03-22 From: "Beau Gould" <bg-at-capitalmarketsp.com> Subject: [NYLXS - HANGOUT] [JOB] Systems Engineer, NYC | 90-100k
  52. 2010-03-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  53. 2010-03-24 einker <eminker-at-gmail.com> Subject: [NYLXS - HANGOUT] Free Software Award Winners Announced
  54. 2010-03-24 einker <eminker-at-gmail.com> Subject: [NYLXS - HANGOUT] Free Software Award Winners Announced
  55. 2010-03-25 redpill <redpill-at-rcn.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  56. 2010-03-25 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] NYLXS Library?
  57. 2010-03-25 swd <sderrick-at-optonline.net> RE: [NYLXS - HANGOUT] NYLXS Library?
  58. 2010-03-30 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Workshop / Hacking Society (Smalltalk, C++, Python) Tuesday March 30 6:00PM-8:00PM

NYLXS are Do'ers and the first step of Doing is Joining! Join NYLXS and make a difference in your community today!