Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #7345 > unrolled thread
| Started by | JetQi Tan <jetqi1011@gmail.com> |
|---|---|
| First post | 2011-07-01 19:01 -0700 |
| Last post | 2011-07-07 16:38 -0500 |
| Articles | 14 — 7 participants |
Back to article view | Back to comp.lang.c++
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
| From | JetQi Tan <jetqi1011@gmail.com> |
|---|---|
| Date | 2011-07-01 19:01 -0700 |
| Subject | please help me to get the coding please |
| Message-ID | <404c4efc-13ee-4159-9854-ba3054722823@p10g2000prf.googlegroups.com> |
Modify the program to ask two integer numbers from the user and then output all the integer numbers in between these two numbers. Assume that the user will enter the first number to be smaller than the second number
[toc] | [next] | [standalone]
| From | Saeed Amrollahi <amrollahi.saeed@gmail.com> |
|---|---|
| Date | 2011-07-01 22:36 -0700 |
| Message-ID | <65617e47-0251-4122-b84a-810d0b2b501a@b21g2000yqc.googlegroups.com> |
| In reply to | #7345 |
On Jul 2, 5:01 am, JetQi Tan <jetqi1...@gmail.com> wrote: > Modify the program to ask two integer numbers from the user and then > output all the integer numbers in > between these two numbers. Assume that the user will enter the first > number to be smaller than the > second number Hi I'm pretty sure, it's a homework and we don't help you in doing assignment. I encourage you, to write it: Use standard input, to read two numbers, then use a for or while loop to enumerate numbers from first to second number and prints them to standard output. Come back with a piece of code. Good luck -- Saeed Amrollahi
[toc] | [prev] | [next] | [standalone]
| From | JetQi Tan <jetqi1011@gmail.com> |
|---|---|
| Date | 2011-07-02 00:29 -0700 |
| Message-ID | <bf65681f-6b18-497a-9dd1-52542272b3ad@y13g2000prb.googlegroups.com> |
| In reply to | #7347 |
BUT ITRY ALREADY,it didnt works...any other solution?
[toc] | [prev] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2011-07-02 19:32 +1200 |
| Message-ID | <977vtdFnfiU11@mid.individual.net> |
| In reply to | #7353 |
On 07/ 2/11 07:29 PM, JetQi Tan wrote: > BUT ITRY ALREADY,it didnt works...any other solution? What did you try? If you want help. post code. -- Ian Collins
[toc] | [prev] | [next] | [standalone]
| From | JetQi Tan <jetqi1011@gmail.com> |
|---|---|
| Date | 2011-07-02 00:37 -0700 |
| Message-ID | <2160a0d3-f32d-4d16-a35b-88aef3fbad6c@r27g2000prr.googlegroups.com> |
| In reply to | #7354 |
#include <iostream>
using namespace std;
int main()
{
int sum;
int num1;
int num2;
cout << "Enter first number:";
cin >> num1;
cout << "Enter second number:";
cin >> num2;
while ( num1 < sum < num2 )
{
cout << sum << " ";
sum = num1 + 1;
}
return 0;
}
(am i wrong?)
[toc] | [prev] | [next] | [standalone]
| From | Saeed Amrollahi <amrollahi.saeed@gmail.com> |
|---|---|
| Date | 2011-07-02 00:49 -0700 |
| Message-ID | <6ada711f-9256-45d6-ae80-c91f85518927@e21g2000vbz.googlegroups.com> |
| In reply to | #7356 |
On Jul 2, 10:37 am, JetQi Tan <jetqi1...@gmail.com> wrote:
> #include <iostream>
> using namespace std;
>
> int main()
> {
> int sum;
> int num1;
> int num2;
>
> cout << "Enter first number:";
> cin >> num1;
>
> cout << "Enter second number:";
> cin >> num2;
>
> while ( num1 < sum < num2 )
> {
> cout << sum << " ";
> sum = num1 + 1;
> }
>
> return 0;
>
> }
>
> (am i wrong?)
Now, it's good. You came back with your code.
I guess, you are going to modify your previous program:
"write a program to sum from 1 to n or some similar programs."
In this program you don't need to sum variable at all. Also,
num1 < sum < num2
doesn't work as you expected.
-- Saeed Amrollahi
[toc] | [prev] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2011-07-02 19:51 +1200 |
| Message-ID | <978115FnfiU12@mid.individual.net> |
| In reply to | #7356 |
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
[toc] | [prev] | [next] | [standalone]
| From | JetQi Tan <jetqi1011@gmail.com> |
|---|---|
| Date | 2011-07-02 01:02 -0700 |
| Message-ID | <32861df1-845f-4480-8f1d-47f98b7b2854@e26g2000prf.googlegroups.com> |
| In reply to | #7360 |
thanks a lot..u guys realy help me a lot,i dnt understand what my teacher said,i will try it now
[toc] | [prev] | [next] | [standalone]
| From | Juha Nieminen <nospam@thanks.invalid> |
|---|---|
| Date | 2011-07-02 06:02 +0000 |
| Message-ID | <4e0eb489$0$2842$7b1e8fa0@news.nbl.fi> |
| In reply to | #7345 |
JetQi Tan <jetqi1011@gmail.com> wrote: > Modify the program What program?
[toc] | [prev] | [next] | [standalone]
| From | JetQi Tan <jetqi1011@gmail.com> |
|---|---|
| Date | 2011-07-02 00:32 -0700 |
| Message-ID | <59779ee5-dafa-4a25-8ab8-2d78d8d6ab09@r21g2000pri.googlegroups.com> |
| In reply to | #7349 |
c++
[toc] | [prev] | [next] | [standalone]
| From | Juha Nieminen <nospam@thanks.invalid> |
|---|---|
| Date | 2011-07-02 08:15 +0000 |
| Message-ID | <4e0ed3ba$0$2865$7b1e8fa0@news.nbl.fi> |
| In reply to | #7355 |
JetQi Tan <jetqi1011@gmail.com> wrote: > c++ C++ is not a program, it's a programming language. The original question started with "modify the program". What program?
[toc] | [prev] | [next] | [standalone]
| From | gottloser Vaterlandsverraeter <vaterlandsverraeter@gmail.com> |
|---|---|
| Date | 2011-07-02 09:48 +0200 |
| Message-ID | <iumigg$5lr$1@speranza.aioe.org> |
| In reply to | #7345 |
Am 02.07.2011 04:01, schrieb JetQi Tan:
> Modify the program to ask two integer numbers from the user and then
> output all the integer numbers in
> between these two numbers. Assume that the user will enter the first
> number to be smaller than the
> second number
///////////////////////////////////////////////////////////////////////
/* to compile run:
*
* g++ -o numbers numbers.cpp
*
*/
// include the iostream functionality from iostream.h
#include <iostream>
using namespace std;
// main function
main(){
cout<< "Enter first number"<< endl;
int first, second;
cin>> first;
cout<< "Enter second number"<< endl;
cin>> second;
for(int counter = first;
counter <= second;
counter++){
cout<< counter<< ", ";
}
cout<< endl;
}
/////////////////////////////////////////////////////////////
[toc] | [prev] | [next] | [standalone]
| From | Ruben Safir <ruben@mrbrklyn.com> |
|---|---|
| Date | 2011-07-03 03:24 +0000 |
| Message-ID | <iuond3$a2n$1@reader1.panix.com> |
| In reply to | #7345 |
On Fri, 01 Jul 2011 19:01:49 -0700, JetQi Tan wrote: > Modify the program to ask two integer numbers from the user and then > output all the integer numbers in > between these two numbers. Assume that the user will enter the first > number to be smaller than the > second number For $800.00 USD I'll write it for you. Ruben
[toc] | [prev] | [next] | [standalone]
| From | "MikeP" <mp011011@some.org> |
|---|---|
| Date | 2011-07-07 16:38 -0500 |
| Message-ID | <iv58vn$eg6$1@dont-email.me> |
| In reply to | #7345 |
JetQi Tan wrote: > Modify the program to ask two integer numbers from the user and then > output all the integer numbers in > between these two numbers. Assume that the user will enter the first > number to be smaller than the > second number Only The Architect can modify the program (I assume you are not Neo). You should probably seek The Oracle or The Keymaker for more insight/help.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.c++
csiph-web