Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #7360

Re: please help me to get the coding please

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: please help me to get the coding please
Date Sat, 02 Jul 2011 19:51:30 +1200
Lines 45
Message-ID <978115FnfiU12@mid.individual.net> (permalink)
References <404c4efc-13ee-4159-9854-ba3054722823@p10g2000prf.googlegroups.com> <65617e47-0251-4122-b84a-810d0b2b501a@b21g2000yqc.googlegroups.com> <bf65681f-6b18-497a-9dd1-52542272b3ad@y13g2000prb.googlegroups.com> <977vtdFnfiU11@mid.individual.net> <2160a0d3-f32d-4d16-a35b-88aef3fbad6c@r27g2000prr.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net DNrGuGL2YWR47GiBI/LSvAywJI8rMLsQgg6Smqph+D+XJlldir
Cancel-Lock sha1:mKwhZTPcpvsT/Afr+4pBAEexBME=
User-Agent Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4
In-Reply-To <2160a0d3-f32d-4d16-a35b-88aef3fbad6c@r27g2000prr.googlegroups.com>
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:7360

Show key headers only | View raw


On 07/ 2/11 07:37 PM, JetQi Tan wrote:

Please keep the part of the previous post you are replying to and who 
posted it.

> #include<iostream>
> using namespace std;
>
>
> int main()
> {
>     int sum;
>     int num1;
>     int num2;

It is generally better to declare variables just before you use them.

>     cout<<  "Enter first number:";
>     cin>>  num1;
>
>     cout<<  "Enter second number:";
>     cin>>  num2;
>
>
>     while ( num1<  sum<  num2 )

This is a really strange expression!  What value should sum start at and 
whet value should it end before?  Try using a for loop, it should then 
be much clearer to you.

>     {
>     cout<<  sum<<  " ";
>     sum = num1 + 1;

This is causing an infinite loop.  You want to increment sum here, not 
fix its value.

>     }
>
>
>     return 0;
> }

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

please help me to get the coding please JetQi Tan <jetqi1011@gmail.com> - 2011-07-01 19:01 -0700
  Re: please help me to get the coding please Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-07-01 22:36 -0700
    Re: please help me to get the coding please JetQi Tan <jetqi1011@gmail.com> - 2011-07-02 00:29 -0700
      Re: please help me to get the coding please Ian Collins <ian-news@hotmail.com> - 2011-07-02 19:32 +1200
        Re: please help me to get the coding please JetQi Tan <jetqi1011@gmail.com> - 2011-07-02 00:37 -0700
          Re: please help me to get the coding please Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-07-02 00:49 -0700
          Re: please help me to get the coding please Ian Collins <ian-news@hotmail.com> - 2011-07-02 19:51 +1200
            Re: please help me to get the coding please JetQi Tan <jetqi1011@gmail.com> - 2011-07-02 01:02 -0700
  Re: please help me to get the coding please Juha Nieminen <nospam@thanks.invalid> - 2011-07-02 06:02 +0000
    Re: please help me to get the coding please JetQi Tan <jetqi1011@gmail.com> - 2011-07-02 00:32 -0700
      Re: please help me to get the coding please Juha Nieminen <nospam@thanks.invalid> - 2011-07-02 08:15 +0000
  Re: please help me to get the coding please gottloser Vaterlandsverraeter <vaterlandsverraeter@gmail.com> - 2011-07-02 09:48 +0200
  Re: please help me to get the coding please Ruben Safir <ruben@mrbrklyn.com> - 2011-07-03 03:24 +0000
  Re: please help me to get the coding please "MikeP" <mp011011@some.org> - 2011-07-07 16:38 -0500

csiph-web