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

Thread: C++

  1. #1
    Join Date
    Jun 2011
    Posts
    10

    C++

    #include<iostream>
    using namespace std;

    int main()
    {
    int data;

    cout<<"Enter 0 to stop entering data and display product";
    cout << endl;
    while (data !=0)
    {
    cout << "Enter data:";
    cin >> data;
    }
    system("pause");
    return 0;
    }

    I've done it all except I need to calculate ONLY POSITIVE NUMBERS the product of them

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: C++

    Quote Originally Posted by Lilcrew View Post
    I've done it all except I need to calculate ONLY POSITIVE NUMBERS the product of them
    You really haven't done anything except write a loop that gets input from the keyboard. You haven't written anything to solve the problem you're stating.

    If this is homework, then you need to make more of an attempt.

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Dec 2010
    Posts
    20

    Re: C++

    you will get endless loop if the input isn't integer.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured