Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #7344 > unrolled thread
| Started by | JetQi Tan <jetqi1011@gmail.com> |
|---|---|
| First post | 2011-07-01 19:04 -0700 |
| Last post | 2011-07-02 21:32 +0000 |
| Articles | 9 — 6 participants |
Back to article view | Back to comp.lang.c++
please give me the coding please... JetQi Tan <jetqi1011@gmail.com> - 2011-07-01 19:04 -0700
Re: please give me the coding please... "MikeP" <mp011011@some.org> - 2011-07-02 00:08 -0500
Re: please give me the coding please... JetQi Tan <jetqi1011@gmail.com> - 2011-07-02 00:33 -0700
Re: please give me the coding please... Dombo <dombo@disposable.invalid> - 2011-07-02 12:03 +0200
Re: please give me the coding please... Qi <no@no.com> - 2011-07-03 10:36 +0800
Re: please give me the coding please... "MikeP" <mp011011@some.org> - 2011-07-04 23:51 -0500
Re: please give me the coding please... "MikeP" <mp011011@some.org> - 2011-07-04 23:34 -0500
Re: please give me the coding please... Puppet_Sock <puppet_sock@hotmail.com> - 2011-07-02 13:09 -0700
Re: please give me the coding please... jt@toerring.de (Jens Thoms Toerring) - 2011-07-02 21:32 +0000
| From | JetQi Tan <jetqi1011@gmail.com> |
|---|---|
| Date | 2011-07-01 19:04 -0700 |
| Subject | please give me the coding please... |
| Message-ID | <d9a2a528-4ae0-489a-8bd1-db5cd1492d41@b39g2000prd.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 | "MikeP" <mp011011@some.org> |
|---|---|
| Date | 2011-07-02 00:08 -0500 |
| Message-ID | <ium94j$tgr$1@dont-email.me> |
| In reply to | #7344 |
Identify.
[toc] | [prev] | [next] | [standalone]
| From | JetQi Tan <jetqi1011@gmail.com> |
|---|---|
| Date | 2011-07-02 00:33 -0700 |
| Message-ID | <3850bb16-0711-43bf-818c-aa229a06ad16@q14g2000prh.googlegroups.com> |
| In reply to | #7346 |
how?i really need help here,i dont understand what my teacher tought
[toc] | [prev] | [next] | [standalone]
| From | Dombo <dombo@disposable.invalid> |
|---|---|
| Date | 2011-07-02 12:03 +0200 |
| Message-ID | <4e0eecd6$0$30703$5fc3050@news.tiscali.nl> |
| In reply to | #7357 |
Op 02-Jul-11 9:33, JetQi Tan schreef: > how?i really need help here,i dont understand what my teacher tought How about asking your teacher to explain it to you. That is what he or she is being paid for.
[toc] | [prev] | [next] | [standalone]
| From | Qi <no@no.com> |
|---|---|
| Date | 2011-07-03 10:36 +0800 |
| Message-ID | <iuokot$tbh$1@speranza.aioe.org> |
| In reply to | #7357 |
On 2011-7-2 15:33, JetQi Tan wrote: > how?i really need help here,i dont understand what my teacher tought If you are sure you listened to your teacher carefully during the course, ask your school to fire your teacher then. -- WQ
[toc] | [prev] | [next] | [standalone]
| From | "MikeP" <mp011011@some.org> |
|---|---|
| Date | 2011-07-04 23:51 -0500 |
| Message-ID | <iuu58o$88d$1@dont-email.me> |
| In reply to | #7390 |
Qi wrote: > On 2011-7-2 15:33, JetQi Tan wrote: >> how?i really need help here,i dont understand what my teacher tought > > If you are sure you listened to your teacher carefully during > the course, ask your school to fire your teacher then. And teaching is fun too. What is "teaching"? Can one teach? "teaching" is oxymoronic. One can only present and perhaps facilitate and enable, but for learning to occur, someone has to be seeking knowledge. Isn't it quite arrogant for someone to call themselves "a teacher"? Shouldn't the focus be on learning, for why focus on something that can't be done (if it can't be done, i.e.). This person is a good self-learner, to which I am deeply greatful to my hero, the well-reknown Jack Handey (http://iamkraze.com/my-favorite-jack-handey-quotes-deep-thoughts). People have various preferred or required modes of learning: allusion to the many times recited "visual, auditory, tactile" learning modes. Most people have varying degrees of all of those. There is more than just those though. There is the inductive and deductive (reasoning) and the associated top-down/bottom-up, and, general-to-specific/specific-to-general "approaches". "Language lawyers" surely must be bottom-up reasoners.while designers surely seem to top-down reasoners. The detail first or the big picture? Pick up the big pile of trash first or sweep up the crumbs first? The methods can be had as "approaches" to solution development. When little a priori knowledge exists, a bottom-up approach may not only be prudent, but may be the only way to procede, while a top-down approach may very well be prudent in the opposite case. Anyone wanna bet that I can't work-in the term "language lawyer" in every USENET post I make? (RHETORICAL and JUST KIDDING!!).
[toc] | [prev] | [next] | [standalone]
| From | "MikeP" <mp011011@some.org> |
|---|---|
| Date | 2011-07-04 23:34 -0500 |
| Message-ID | <iuu48v$41b$1@dont-email.me> |
| In reply to | #7357 |
JetQi Tan wrote: > how?i really need help here,i dont understand what my teacher tought Biometric identification not found. You are not authorized to access this server. Your location is being neutralized.
[toc] | [prev] | [next] | [standalone]
| From | Puppet_Sock <puppet_sock@hotmail.com> |
|---|---|
| Date | 2011-07-02 13:09 -0700 |
| Message-ID | <2ee43b72-d534-46b9-b626-a96d73bceaf9@d1g2000yqm.googlegroups.com> |
| In reply to | #7344 |
On Jul 1, 10:04 pm, 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 Please post your teacher's email address. We will send the solution directly and so not inconvenience you with having to copy it. Socks
[toc] | [prev] | [next] | [standalone]
| From | jt@toerring.de (Jens Thoms Toerring) |
|---|---|
| Date | 2011-07-02 21:32 +0000 |
| Message-ID | <979h32F6t6U1@mid.uni-berlin.de> |
| In reply to | #7344 |
JetQi Tan <jetqi1011@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
Since there's no program to modify given here's a version that
should work according to your specifications:
#include <iostream>
#include <string>
#include <cstdlib>
#include <limits>
#include <vector>
#include <algorithm>
#include <boost/assign/std/vector.hpp>
static int b(){std::string s;std::getline(std::cin,s);char *ep;
long i=strtol(s.c_str(),&ep,10);return (ep!=s.c_str()+s.length()||i>
std::numeric_limits<int>::max()||i<std::numeric_limits<int>::min())?b():i;}
template<typename Q7>Q7 v(Q7 wr){std::cout<<wr<<std::endl;return wr;}
template<typename K1xQ>class next{private:K1xQ s;public:next(K1xQ s):s(s)
{}K1xQ operator()(){return v<K1xQ>(s++);}};
int main(){std::vector<int>q;q.push_back(b());
boost::assign::push_back(q).repeat_fun(b()-q.back()+1,next<int>(q.back()));}
Note that both numbers must be entered on their own lines with
no additional characters (like spaces etc.) before or after them.
Of course, there might be other and even slightly more efficient
ways to do it, but for this relatively simple problem it hope-
fully will be fast enough.
HTH, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.c++
csiph-web