PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > Need i need a programmer
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Need i need a programmer

Réponse
 
LinkBack Outils de la discussion
Vieux 18/10/2007, 10h56   #1
zohaib.shirani@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Need i need a programmer

i have got a quizz to write a programm that gives the sum of all even
numbers between two variables x and y and then displays the sum.
Include both x and y in the total sum.


Any one here can me............ ?

  Réponse avec citation
Vieux 18/10/2007, 11h46   #2
Alf P. Steinbach
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Need i need a programmer

* zohaib.shirani@gmail.com:
> i have got a quizz to write a programm that gives the sum of all even
> numbers between two variables x and y and then displays the sum.
> Include both x and y in the total sum.
>
>
> Any one here can me............ ?



You're in luck, this was recently answered by the FAQ.

Since the Parashift server seems to be down, see e.g. <url:
http://www.coders2020.com/cplusplus-explained/index.html>, FAQ item 5.2.

Cheers, & rhth.,

- Alf


--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
  Réponse avec citation
Vieux 18/10/2007, 11h54   #3
Erik Wikström
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Need i need a programmer

On 2007-10-18 11:56, zohaib.shirani@gmail.com wrote:
> i have got a quizz to write a programm that gives the sum of all even
> numbers between two variables x and y and then displays the sum.
> Include both x and y in the total sum.
>
>
> Any one here can me............ ?


Start by writing a program that reads in two integers, then figure out
how to get all numbers between those that you read in. Then figure out
how to sum up all those numbers. Then exclude those that are odd. For
more information read the FAQ, section 5.2 is particularly relevant:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.2

--
Erik Wikström
  Réponse avec citation
Vieux 18/10/2007, 12h03   #4
Nick Keighley
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Need i need a programmer

On 18 Oct, 10:56, zohaib.shir...@gmail.com wrote:

> i have got a quizz to [...]


the idea of a "quiz" is for *you* to do the work


> write a programm that gives the sum of all even
> numbers between two variables x and y and then displays the sum.
> Include both x and y in the total sum.
>
> Any one here can me............ ?


in NAPSIC (Nick's All Purpose Symbolic Instruction Code)

DEFINE print_sum_evens (INTEGER x, y)
INTEGER sum <- 0;

FOR ALL i IN RANGE (x, y)
IF is_even (i)
sum <- sum + i
END
END

PRINT sum
END


--
Nick Keighley

  Réponse avec citation
Vieux 18/10/2007, 12h06   #5
zohaib.shirani@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Need i need a programmer

On Oct 18, 4:03 pm, Nick Keighley <nick_keighley_nos...@hotmail.com>
wrote:
> On 18 Oct, 10:56, zohaib.shir...@gmail.com wrote:
>
> > i have got a quizz to [...]

>
> the idea of a "quiz" is for *you* to do the work
>
> > write a programm that gives the sum of all even
> > numbers between two variables x and y and then displays the sum.
> > Include both x and y in the total sum.

>
> > Any one here can me............ ?

>
> in NAPSIC (Nick's All Purpose Symbolic Instruction Code)
>
> DEFINE print_sum_evens (INTEGER x, y)
> INTEGER sum <- 0;
>
> FOR ALL i IN RANGE (x, y)
> IF is_even (i)
> sum <- sum + i
> END
> END
>
> PRINT sum
> END
>
> --
> Nick Keighley


Remember i am woking in C++ with complier VC..... Sorry 4 not telling
u that

  Réponse avec citation
Vieux 18/10/2007, 12h31   #6
Zeppe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Need i need a programmer

zohaib.shirani@gmail.com wrote:
> On Oct 18, 4:03 pm, Nick Keighley <nick_keighley_nos...@hotmail.com>
> wrote:
>> On 18 Oct, 10:56, zohaib.shir...@gmail.com wrote:
>>
>>> i have got a quizz to [...]

>> the idea of a "quiz" is for *you* to do the work
>>
>>> write a programm that gives the sum of all even
>>> numbers between two variables x and y and then displays the sum.
>>> Include both x and y in the total sum.
>>> Any one here can me............ ?

>> in NAPSIC (Nick's All Purpose Symbolic Instruction Code)
>>
>> DEFINE print_sum_evens (INTEGER x, y)
>> INTEGER sum <- 0;
>>
>> FOR ALL i IN RANGE (x, y)
>> IF is_even (i)
>> sum <- sum + i
>> END
>> END
>>
>> PRINT sum
>> END
>>
>> --
>> Nick Keighley

>
> Remember i am woking in C++ with complier VC..... Sorry 4 not telling
> u that
>


and how many tablespoon of sugar would you like in the coffee, sir?

Regards,

Zeppe
  Réponse avec citation
Vieux 18/10/2007, 13h33   #7
LR
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Need i need a programmer

zohaib.shirani@gmail.com wrote:
> On Oct 18, 4:03 pm, Nick Keighley <nick_keighley_nos...@hotmail.com>
> wrote:
>> On 18 Oct, 10:56, zohaib.shir...@gmail.com wrote:
>>
>>> i have got a quizz to [...]

>> the idea of a "quiz" is for *you* to do the work


>
> Remember i am woking in C++ with complier VC..... Sorry 4 not telling
> u that


I think you're far more likely to get here by showing what you have
done so far rather than making a request for someone else to show you
how to do it.

What have you tried so far?

LR






  Réponse avec citation
Vieux 18/10/2007, 15h07   #8
Andre Kostur
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Need i need a programmer

zohaib.shirani@gmail.com wrote in news:1192705580.055095.159270
@e9g2000prf.googlegroups.com:

> On Oct 18, 4:03 pm, Nick Keighley <nick_keighley_nos...@hotmail.com>
> wrote:
>> On 18 Oct, 10:56, zohaib.shir...@gmail.com wrote:
>>
>> > i have got a quizz to [...]

>>
>> the idea of a "quiz" is for *you* to do the work
>>
>> > write a programm that gives the sum of all even
>> > numbers between two variables x and y and then displays the sum.
>> > Include both x and y in the total sum.

>>
>> > Any one here can me............ ?

>>
>> in NAPSIC (Nick's All Purpose Symbolic Instruction Code)
>>
>> DEFINE print_sum_evens (INTEGER x, y)
>> INTEGER sum <- 0;
>>
>> FOR ALL i IN RANGE (x, y)
>> IF is_even (i)
>> sum <- sum + i
>> END
>> END
>>
>> PRINT sum
>> END
>>
>> --
>> Nick Keighley

>
> Remember i am woking in C++ with complier VC..... Sorry 4 not telling
> u that
>


Nick is very well aware that you wanted C++ code. Which is exactly why
he didn't write his program in C++. He's not going to hand you the
solution on a silver platter (neither will anybody else here). The
point is for _you_ to do the work, not for one of us to do it for you.
You won't learn anything that way.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h15.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13723 seconds with 16 queries