CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: C++ problem please help

  1. #1
    Join Date
    Oct 2008
    Posts
    52

    C++ problem please help

    Can anyone help me out with this C++ problem?


    Write a program that reads a series of numbers (doubles) from the user, then prints the mean and the
    range.
    Notes:
    You do not know ahead of time how many numbers will be in the list.
    When you want to stop entering numbers, enter control‐Z.
    The range is the difference between the lowest and the highest number.
    The numbers will be in the range of 0.0 to 100.0. Ignore any numbers outside of this range.



    The output should look like this:

    1.11
    2.22
    3.33
    4.44
    5.55
    ^Z
    The average is 3.33
    The range is 4.44
    Press any key to continue . . .


    and like this also:


    0.01
    0.00
    -0.01
    out of range; ignored.
    99.0
    99.5
    99.9
    100.0
    100.01
    out of range; ignored.
    ^Z
    The average is 66.4017
    The range is 100
    Press any key to continue . . .

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,578

    Re: C++ problem please help

    Deja vu?

    http://www.codeguru.com/forum/showthread.php?t=462810

    Pretty similar user name too. Be sure to thank your classmate for the help.
    Last edited by GCDEF; October 15th, 2008 at 02:29 PM.

  3. #3
    Join Date
    Oct 2008
    Posts
    52

    Re: C++ problem please help

    so far, all I have is this:

    #include <iostream>
    #include <string>

    using namespace std;

    int main ()
    {
    string average = "";
    int range = 10;
    while (x > 0)
    {
    cout << " The average is " << average << endl;
    cout << " The range is " << range << endl;
    }

    Please help me out or point me in right direction.

    Thanks,
    Matt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)