C programming

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lady dyna
    New Member
    • Mar 2007
    • 6

    #1

    C programming

    Write a program that displays the values of x and y in a 'for loop'. The program is terminated by the assert() macro as soon as the condition x < y becomes false.
    Initialize y to 3 and increment x in a 'for loop'. When x reaches the value 3, the macro should display the output on stderr, which is always the display screen. Not only do you get the condition that failed displayed, but you also get the file name and line number in the file where the failure occurred. This is particularly useful with multifile programs in which the source of the error is pinpointed exactly.
    Sample Output
    x = 0 y = 3
    x = 1 y = 3
    x = 2 y = 3
    x = 3 y = 3

    Assertion failed: x<y , file FILENAME.C, line LINENO
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Yes, and your question is?

    kind regards,

    Jos

    Comment

    • Lady dyna
      New Member
      • Mar 2007
      • 6

      #3
      Originally posted by JosAH
      Yes, and your question is?

      kind regards,

      Jos

      what yes??

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by Lady dyna
        what yes??
        Yes, as in yes, I assume you've read the forum guidelines.

        kind regards,

        Jos

        Comment

        • Lady dyna
          New Member
          • Mar 2007
          • 6

          #5
          Originally posted by JosAH
          Yes, as in yes, I assume you've read the forum guidelines.

          kind regards,

          Jos
          yes i have been study, but plz help me in programming.

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by Lady dyna
            yes i have been study, but plz help me in programming.
            Good; so show us what you've been trying to accomplish and I'm sure most of
            us will try to help you out but the initiative is on your side; we're not doing your
            homework for you. You're supposed to learn from your homework, not us.

            kind regards,

            Jos

            Comment

            Working...