1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

While loop

  1. Aug 20, 2016 #1
    1. The problem statement, all variables and given/known data
    for teh circled part , why there's again =='y' ? i didnt see the variable 'y' anywhere other than the circled part ...What does it mean ?
    2. Relevant equations


    3. The attempt at a solution
    Is the code wrong ?
     

    Attached Files:

    • 1.PNG
      1.PNG
      File size:
      14.8 KB
      Views:
      44
  2. jcsd
  3. Aug 20, 2016 #2

    gneill

    User Avatar

    Staff: Mentor

    Characters in quotes are character constants. The statement in question is checking whether the user has input a 'Y' or a 'y' (so that both upper and lower case are checked).
     
  4. Aug 21, 2016 #3

    Mark44

    Staff: Mentor

    @chetzread, before you learned about loops and other control structures, there was probably some mention about the various types of constants that can be used in C. At least most of the books I've seen present such material in that order.

    Character constants, such as 'y' or 'B' or '\t'
    String constants, such as "cat"
    integer constants, such as 23, 023, and 0x23 (all with different values)
    floating point constants, such as 2.7 (a double) and 3.09F (a float)
    This is not meant to be an exhaustive list.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: While loop
  1. While loop (Replies: 1)

  2. Matlab while loop help (Replies: 15)

  3. C++- while-loop (Replies: 7)

Loading...