CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Building Interactive UIs with ASP.NET Ajax: Rebinding Client-Side Events After a Partial Page Postback
  • Speed Up Repetitive Insert, Update, and Delete Query Statements
  • Binding Data to Silverlight 4.0 Controls Using ASP.NET MVC Framework 2.0
  • ADO.NET Data Services in the .NET Framework

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > .NET Programming > C-Sharp Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    C-Sharp Programming Post questions, answers, and comments about C#.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old October 31st, 2009, 06:33 PM
    Weems316 Weems316 is offline
    Junior Member
     
    Join Date: Oct 2009
    Posts: 1
    Weems316 is an unknown quantity at this point (<10)
    Do While Loops

    Hi everyone,

    Before i start i've gotta admit i'm new when it comes to coding. For our college work we've gotta create a programme that lets a user input some numbers until 0 is entered. Upon entering 0 the programme then spits out how many of the numbers put in are even and how many are odd. Now we've been told we've gotta use the modulus division and a do while loop, but i've got completely stuck and have no idea what to do.

    Cheers for any help,
    Regards,
    Weems316.
    Reply With Quote
      #2    
    Old October 31st, 2009, 07:25 PM
    BigEd781 BigEd781 is offline
    Senior Member
     
    Join Date: Jun 2008
    Posts: 1,645
    BigEd781 is a splendid one to behold (750+)BigEd781 is a splendid one to behold (750+)BigEd781 is a splendid one to behold (750+)BigEd781 is a splendid one to behold (750+)BigEd781 is a splendid one to behold (750+)BigEd781 is a splendid one to behold (750+)BigEd781 is a splendid one to behold (750+)BigEd781 is a splendid one to behold (750+)
    Re: Do While Loops

    The modulus requirement doesn't make sense going with the information that you have provided, but the do while loop is pretty simple:

    Code:
    do
    {
        // grab input
    } (while input != "0")
    Reply With Quote
      #3    
    Old November 1st, 2009, 07:41 AM
    Mutant_Fruit Mutant_Fruit is offline
    Senior Member
     
    Join Date: May 2007
    Posts: 1,346
    Mutant_Fruit is a splendid one to behold (750+)Mutant_Fruit is a splendid one to behold (750+)Mutant_Fruit is a splendid one to behold (750+)Mutant_Fruit is a splendid one to behold (750+)Mutant_Fruit is a splendid one to behold (750+)Mutant_Fruit is a splendid one to behold (750+)Mutant_Fruit is a splendid one to behold (750+)Mutant_Fruit is a splendid one to behold (750+)
    Re: Do While Loops

    The modulus operator can be used to tell you whether a number is even or odd. I'll leave it as an excercise to the reader [0] to figure out exactly how to do it.

    [0] heh heh heh, i feel like a lecturer now I always wanted to say that!
    __________________
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > .NET Programming > C-Sharp Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 02:25 AM.



    Acceptable Use Policy

    Internet.com
    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.