counters

This is a discussion on counters within the C++ Programming forums, part of the General Programming Boards category; Then you need to ask for an age, and check the age that was given....

  1. #16
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Then you need to ask for an age, and check the age that was given.

  2. #17
    Registered User
    Join Date
    Jul 2008
    Posts
    72
    Yes, I did. That's my first part.

    Code:
    cout << "\nHow old are you ?: ";
      cin >> age;
            
            
      if ( age > 17)
      cout << " You can vote. \n" ;
      
      else
      
      cout << " You can not vote. \n" ;
    That's right before the counter part. Dosen't give me an error.

  3. #18
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    So make up your mind what you want to do:

    1) Ask one person their age and determine voting status.
    2) Print I love computers 5 times.
    3) Other (please specify): ____________________________

  4. #19
    Registered User
    Join Date
    Jul 2008
    Posts
    72
    This is all included in the output part. I need to include both.


    output
    if age greater than 17
    display "You can vote."
    else
    display "You can't vote."
    endif

    counter is assigned 0
    while counter is less than 5
    display "\nI love computers!"
    increment counter
    endwhile

  5. #20
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    So the first bit gets an age (presumably) and checks whether the person is of voting age. The second bit prints "I love computers" five times.

    Do you think that these bits are related in any way? If so, go to Student Health and have them adjust your medication level.

    If you want to do something other than print "I love computers" five times after asking someone their age, then you need to state, as clearly as you can, what it is that you are trying to do.

  6. #21
    Registered User
    Join Date
    Jul 2008
    Posts
    72
    Honestly, I do not know myself. That's all I have in terms of instructions. I think if the value is less than 5 it's supposed to print I love computers. I guess like a joke... someone who is younger than 5 can probably not use the computer.

    So , I get the age first. Tell the user if he can or can't vote. In case he's younger than 5 it's supposed to say I love computers.

    And I'll just ignore the insult.
    Last edited by XodoX; 03-08-2009 at 10:43 PM.

  7. #22
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    There's a difference between printing "I love computers" five times and printing I love computers one time, if the age is less than five. Your pseudocode is for the first.

    If you don't know what your assignment is, then I don't know how much more anyone (including you) can do about it.

  8. #23
    Registered User
    Join Date
    Jul 2008
    Posts
    72
    all right. Just nevermind then.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Cycle counters
    By cosmo1996 in forum C Programming
    Replies: 3
    Last Post: 08-14-2007, 09:33 AM
  2. [C] Best way to save matrix counters
    By Nazgulled in forum C Programming
    Replies: 7
    Last Post: 03-24-2006, 04:02 PM
  3. array of counters
    By luigi40 in forum C# Programming
    Replies: 3
    Last Post: 12-11-2005, 01:25 AM
  4. Having trouble with counters
    By tameeyore in forum C Programming
    Replies: 30
    Last Post: 10-08-2004, 02:14 PM
  5. array of counters
    By dantestwin in forum C++ Programming
    Replies: 5
    Last Post: 07-04-2004, 11:14 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21