<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: 5.5 &#8212; While statements</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/55-while-statements/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/55-while-statements/</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 12:30:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: JustACPlusPluser</title>
		<link>http://www.learncpp.com/cpp-tutorial/55-while-statements/comment-page-1/#comment-96731</link>
		<dc:creator>JustACPlusPluser</dc:creator>
		<pubDate>Fri, 23 Dec 2011 14:25:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/55-while-statements/#comment-96731</guid>
		<description>I posted the following code into MS Visual C++ 2010 Express:

#include &quot;stdafx.h&quot;
#include 
#include &quot;stdafx.h&quot;
using namespace std;

int iii = 3;
while (iii &lt; 10)
    {
    cout &lt;&lt; iii &lt;&lt; &quot; &quot;;
    iii++;
    }
cout &lt;&lt; &quot;done!&quot;;

And the while statement says it &quot;expected a declaration&quot;, plus when I try to compile, it gives me a bunch of errors about a missing semicolon. Please help ASAP,

James</description>
		<content:encoded><![CDATA[<p>I posted the following code into MS Visual C++ 2010 Express:</p>
<p>#include &#8220;stdafx.h&#8221;<br />
#include<br />
#include &#8220;stdafx.h&#8221;<br />
using namespace std;</p>
<p>int iii = 3;<br />
while (iii &lt; 10)<br />
    {<br />
    cout &lt;&lt; iii &lt;&lt; &quot; &quot;;<br />
    iii++;<br />
    }<br />
cout &lt;&lt; &quot;done!&quot;;</p>
<p>And the while statement says it &quot;expected a declaration&quot;, plus when I try to compile, it gives me a bunch of errors about a missing semicolon. Please help ASAP,</p>
<p>James</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zingmars</title>
		<link>http://www.learncpp.com/cpp-tutorial/55-while-statements/comment-page-1/#comment-96115</link>
		<dc:creator>zingmars</dc:creator>
		<pubDate>Sat, 08 Oct 2011 12:45:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/55-while-statements/#comment-96115</guid>
		<description>What exactly do you mean by &#039;what is the input of this one &#039;?</description>
		<content:encoded><![CDATA[<p>What exactly do you mean by &#8216;what is the input of this one &#8216;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mac</title>
		<link>http://www.learncpp.com/cpp-tutorial/55-while-statements/comment-page-1/#comment-95771</link>
		<dc:creator>mac</dc:creator>
		<pubDate>Fri, 22 Jul 2011 02:40:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/55-while-statements/#comment-95771</guid>
		<description>from left to right up, and also downwards.....</description>
		<content:encoded><![CDATA[<p>from left to right up, and also downwards&#8230;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mac</title>
		<link>http://www.learncpp.com/cpp-tutorial/55-while-statements/comment-page-1/#comment-95770</link>
		<dc:creator>mac</dc:creator>
		<pubDate>Fri, 22 Jul 2011 02:37:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/55-while-statements/#comment-95770</guid>
		<description>what is the input of this one and also the reverse, using the for loop ,pls help asap
    *                    
   **                  
  ***
 ****
*****</description>
		<content:encoded><![CDATA[<p>what is the input of this one and also the reverse, using the for loop ,pls help asap<br />
    *<br />
   **<br />
  ***<br />
 ****<br />
*****</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WordPress</title>
		<link>http://www.learncpp.com/cpp-tutorial/55-while-statements/comment-page-1/#comment-95675</link>
		<dc:creator>WordPress</dc:creator>
		<pubDate>Thu, 07 Jul 2011 12:34:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/55-while-statements/#comment-95675</guid>
		<description>It&#039;s not Fibonacci, but it&#039;s the triangle-number sequence.</description>
		<content:encoded><![CDATA[<p>It&#8217;s not Fibonacci, but it&#8217;s the triangle-number sequence.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kakatu</title>
		<link>http://www.learncpp.com/cpp-tutorial/55-while-statements/comment-page-1/#comment-95199</link>
		<dc:creator>kakatu</dc:creator>
		<pubDate>Tue, 22 Feb 2011 12:24:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/55-while-statements/#comment-95199</guid>
		<description>I have a problem with my assignment. Can you help me, please? 
Here is the assignment:
to make telephone numbers easier to remember, some companies use letters to show their telephone number.for example using letters,the telephone number 438-5626 can be shown as GET LOAN.in some cases, to make a telephone number meaningful, companies might use more than seven letters. for example,225-5466 can be displayed as CALL HOME, which uses 8 letters. write a program that prompts the user to enter a telephone number expressed in letters and output the corresponding telephone number in digits. if the user enter more than seven letters then process only the first seven letters. also output the -(hyphen) after the third digit. allow the user to use both uppercase and lowercase letters as well as spaces between word.moreover, your program should process a many telephone numbers as the user wants. (the program must use while statement)</description>
		<content:encoded><![CDATA[<p>I have a problem with my assignment. Can you help me, please?<br />
Here is the assignment:<br />
to make telephone numbers easier to remember, some companies use letters to show their telephone number.for example using letters,the telephone number 438-5626 can be shown as GET LOAN.in some cases, to make a telephone number meaningful, companies might use more than seven letters. for example,225-5466 can be displayed as CALL HOME, which uses 8 letters. write a program that prompts the user to enter a telephone number expressed in letters and output the corresponding telephone number in digits. if the user enter more than seven letters then process only the first seven letters. also output the -(hyphen) after the third digit. allow the user to use both uppercase and lowercase letters as well as spaces between word.moreover, your program should process a many telephone numbers as the user wants. (the program must use while statement)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barbarababy</title>
		<link>http://www.learncpp.com/cpp-tutorial/55-while-statements/comment-page-1/#comment-95195</link>
		<dc:creator>Barbarababy</dc:creator>
		<pubDate>Mon, 21 Feb 2011 07:42:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/55-while-statements/#comment-95195</guid>
		<description>I have tried the following, what&#039;s wrong in it?

# include 
# include 

using namespace std;

int main()
{
    double prev_pos = 0;
    double current_pos, 
           change_pos; 
    double prev_vel = 0;
    double current_vel,
           change_vel,
           time_int, 
           avg_vel,
           avg_acc;
    
    change_pos = current_pos - prev_pos;
    change_vel = current_vel - prev_vel;
    current_vel = avg_vel - prev_vel;
    avg_vel = change_pos / time_int;
    avg_acc = change_vel / time_int;
    
    cout &lt;&lt; &quot;Motion Analysis&quot; &lt;&lt; endl;
    cout &lt;&lt; endl;
            
    // ask the user to enter a time interval in second
    
    cout &lt;&gt; time_int;
    cout &lt;&lt; endl;
    cout &lt;= 0 )
          {
          cout &lt;&gt; current_pos;
          cout &lt;&lt; endl;
          cout &lt;&lt; &quot;Average velocity (this interval): &quot;
               &lt;&lt; avg_vel &lt;&lt; &quot; feet/second&quot; &lt;&lt; endl;
          cout &lt;&lt; endl;
          cout &lt;&lt; &quot;Average Acceleration:             &quot;
               &lt;&lt; avg_acc &lt;&lt; &quot; feet/second/second&quot; &lt;&lt; endl &lt;&lt; endl;
       
          if ( current_pos &lt; prev_pos )
             {
             cout &lt;&lt; &quot;Invalid value: &quot; &lt;&lt; current_pos; 
             cout &lt;&lt; &quot; is less than the current position of &quot; &lt;&lt; current_pos;
             cout &lt;&lt; &quot;. Try again.&quot;;
             cout &lt;&lt; endl &lt;&lt; endl;
             }
             else
             {
             cout &lt;&lt; current_pos;
             cout &lt;&lt; endl &lt;&lt; endl;
             }
          }
        
    cout &lt;&lt; endl;
    system (&quot;pause&quot;);
    return 0;</description>
		<content:encoded><![CDATA[<p>I have tried the following, what&#8217;s wrong in it?</p>
<p># include<br />
# include </p>
<p>using namespace std;</p>
<p>int main()<br />
{<br />
    double prev_pos = 0;<br />
    double current_pos,<br />
           change_pos;<br />
    double prev_vel = 0;<br />
    double current_vel,<br />
           change_vel,<br />
           time_int,<br />
           avg_vel,<br />
           avg_acc;</p>
<p>    change_pos = current_pos &#8211; prev_pos;<br />
    change_vel = current_vel &#8211; prev_vel;<br />
    current_vel = avg_vel &#8211; prev_vel;<br />
    avg_vel = change_pos / time_int;<br />
    avg_acc = change_vel / time_int;</p>
<p>    cout &lt;&lt; &quot;Motion Analysis&quot; &lt;&lt; endl;<br />
    cout &lt;&lt; endl;</p>
<p>    // ask the user to enter a time interval in second</p>
<p>    cout &lt;&gt; time_int;<br />
    cout &lt;&lt; endl;<br />
    cout &lt;= 0 )<br />
          {<br />
          cout &lt;&gt; current_pos;<br />
          cout &lt;&lt; endl;<br />
          cout &lt;&lt; &quot;Average velocity (this interval): &quot;<br />
               &lt;&lt; avg_vel &lt;&lt; &quot; feet/second&quot; &lt;&lt; endl;<br />
          cout &lt;&lt; endl;<br />
          cout &lt;&lt; &quot;Average Acceleration:             &quot;<br />
               &lt;&lt; avg_acc &lt;&lt; &quot; feet/second/second&quot; &lt;&lt; endl &lt;&lt; endl;</p>
<p>          if ( current_pos &lt; prev_pos )<br />
             {<br />
             cout &lt;&lt; &quot;Invalid value: &quot; &lt;&lt; current_pos;<br />
             cout &lt;&lt; &quot; is less than the current position of &quot; &lt;&lt; current_pos;<br />
             cout &lt;&lt; &quot;. Try again.&quot;;<br />
             cout &lt;&lt; endl &lt;&lt; endl;<br />
             }<br />
             else<br />
             {<br />
             cout &lt;&lt; current_pos;<br />
             cout &lt;&lt; endl &lt;&lt; endl;<br />
             }<br />
          }</p>
<p>    cout &lt;&lt; endl;<br />
    system (&quot;pause&quot;);<br />
    return 0;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barbarababy</title>
		<link>http://www.learncpp.com/cpp-tutorial/55-while-statements/comment-page-1/#comment-95194</link>
		<dc:creator>Barbarababy</dc:creator>
		<pubDate>Mon, 21 Feb 2011 07:04:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/55-while-statements/#comment-95194</guid>
		<description>Hi Alex, I have a problem with my assignment. Can you help me, please? Here is the assignment:

Write a program that will analyze the data from a physics experiment.
The data consists of a series of position measurements for a moving object. The position measurements will be entered by the user of the program as they are continually prompted. Each of the position measurements that the user enters will have been recorded at uniform time intervals. This time interval will be entered by the user when the program begins and will be followed by the series of position measurements. Each position should be greater than or equal to the previous position because the object is either moving in one direction or still, but never moving backwards. Therefore a negative position measurement will be used to signal the end of the user&#039;s data for the run of the program.
After each of the position measurements has been entered, calculate and display the following:
1.	the average velocity for the time interval
2.	the average acceleration for the time interval
Calculations
Use the following formulas for the calculations:
  change of position = current position - previous position

  change of velocity = current velocity - previous velocity

  average velocity = change of position / time interval
  
  average acceleration = change of velocity / time interval
Notes
1.	The starting position and starting velocity should both be 0.
2.	There should be a loop to validate the position entered by the user. As stated earlier, each position that the user enters must be greater than or equal to the previous position. Each time the user enters an invalid position, an error message that includes the invalid position as well as the previous valid position should be displayed and the user should be given a chance to enter the current position again.
Processing Requirements
1.	At the top of the C++ source code, include a documentation box that resembles the ones from programs 1 and 2.
2.	The program should be fully documented.
3.	Use meaningful variable names.
4.	Make sure and test the program with values other than the ones in the Sample Output.
5.	Hand in a copy of the source code using Blackboard.
Sample Output
Motion Analysis

Enter the uniform time interval in seconds: 2.5



Enter a position in feet (negative value to quit): 2

Average velocity (this interval): 0.80 feet/second
Average acceleration:             0.32 feet/second/second



Enter a position in feet (negative value to quit): 5

Average velocity (this interval): 1.20 feet/second
Average acceleration:             0.16 feet/second/second



Enter a position in feet (negative value to quit): 4

Invalid value: 4 is less than the current position of 5. Try again.



Enter a position in feet (negative value to quit): 12


Average velocity (this interval): 2.80 feet/second
Average acceleration:             0.64 feet/second/second



Enter a position in feet (negative value to quit): -1

Thank you very much!</description>
		<content:encoded><![CDATA[<p>Hi Alex, I have a problem with my assignment. Can you help me, please? Here is the assignment:</p>
<p>Write a program that will analyze the data from a physics experiment.<br />
The data consists of a series of position measurements for a moving object. The position measurements will be entered by the user of the program as they are continually prompted. Each of the position measurements that the user enters will have been recorded at uniform time intervals. This time interval will be entered by the user when the program begins and will be followed by the series of position measurements. Each position should be greater than or equal to the previous position because the object is either moving in one direction or still, but never moving backwards. Therefore a negative position measurement will be used to signal the end of the user&#8217;s data for the run of the program.<br />
After each of the position measurements has been entered, calculate and display the following:<br />
1.	the average velocity for the time interval<br />
2.	the average acceleration for the time interval<br />
Calculations<br />
Use the following formulas for the calculations:<br />
  change of position = current position &#8211; previous position</p>
<p>  change of velocity = current velocity &#8211; previous velocity</p>
<p>  average velocity = change of position / time interval</p>
<p>  average acceleration = change of velocity / time interval<br />
Notes<br />
1.	The starting position and starting velocity should both be 0.<br />
2.	There should be a loop to validate the position entered by the user. As stated earlier, each position that the user enters must be greater than or equal to the previous position. Each time the user enters an invalid position, an error message that includes the invalid position as well as the previous valid position should be displayed and the user should be given a chance to enter the current position again.<br />
Processing Requirements<br />
1.	At the top of the C++ source code, include a documentation box that resembles the ones from programs 1 and 2.<br />
2.	The program should be fully documented.<br />
3.	Use meaningful variable names.<br />
4.	Make sure and test the program with values other than the ones in the Sample Output.<br />
5.	Hand in a copy of the source code using Blackboard.<br />
Sample Output<br />
Motion Analysis</p>
<p>Enter the uniform time interval in seconds: 2.5</p>
<p>Enter a position in feet (negative value to quit): 2</p>
<p>Average velocity (this interval): 0.80 feet/second<br />
Average acceleration:             0.32 feet/second/second</p>
<p>Enter a position in feet (negative value to quit): 5</p>
<p>Average velocity (this interval): 1.20 feet/second<br />
Average acceleration:             0.16 feet/second/second</p>
<p>Enter a position in feet (negative value to quit): 4</p>
<p>Invalid value: 4 is less than the current position of 5. Try again.</p>
<p>Enter a position in feet (negative value to quit): 12</p>
<p>Average velocity (this interval): 2.80 feet/second<br />
Average acceleration:             0.64 feet/second/second</p>
<p>Enter a position in feet (negative value to quit): -1</p>
<p>Thank you very much!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: polabonez</title>
		<link>http://www.learncpp.com/cpp-tutorial/55-while-statements/comment-page-1/#comment-95080</link>
		<dc:creator>polabonez</dc:creator>
		<pubDate>Tue, 28 Dec 2010 16:37:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/55-while-statements/#comment-95080</guid>
		<description>I really just wanted to create an account, log in, just to post a thank you for this all.  I have been attempting to teach myself as with a full time job I don&#039;t have time to go to school.  I have a lot to learn, but just the detail you have gone into so far has been amazing.

Thank again.</description>
		<content:encoded><![CDATA[<p>I really just wanted to create an account, log in, just to post a thank you for this all.  I have been attempting to teach myself as with a full time job I don&#8217;t have time to go to school.  I have a lot to learn, but just the detail you have gone into so far has been amazing.</p>
<p>Thank again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Canute</title>
		<link>http://www.learncpp.com/cpp-tutorial/55-while-statements/comment-page-1/#comment-88220</link>
		<dc:creator>Canute</dc:creator>
		<pubDate>Sat, 10 Jul 2010 07:42:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/55-while-statements/#comment-88220</guid>
		<description>&lt;pre&gt;I don&#039;t know I&#039;m sure this is way late but here if this helps.

&lt;code&gt;
// Loop between 1 and 5
int iii=1;
while (iii&lt;=5)
{
    // loop between 1 and iii
    int jjj = 5;//I flipped 1 to 5 so it starts from bottom up
    while (jjj &gt;= iii)// Flipped &lt;= to &gt;=, if not it would not loop
        cout &lt;&lt; jjj--;//Flipped the minus to so it gets smaller, if not it would be infinite

    // print a newline at the end of each row
    cout &lt;&lt; endl;
    iii++;
}
&lt;!--formatted--&gt;&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<pre>I don't know I'm sure this is way late but here if this helps.

<code>
// Loop between 1 and 5
int iii=1;
while (iii&lt;=5)
{
    // loop between 1 and iii
    int jjj = 5;//I flipped 1 to 5 so it starts from bottom up
    while (jjj &gt;= iii)// Flipped &lt;= to &gt;=, if not it would not loop
        cout &lt;&lt; jjj--;//Flipped the minus to so it gets smaller, if not it would be infinite

    // print a newline at the end of each row
    cout &lt;&lt; endl;
    iii++;
}
<!--formatted--></code></pre>
]]></content:encoded>
	</item>
</channel>
</rss>

