User Profile

Collapse

Profile Sidebar

Collapse
HolyDoom Witch
HolyDoom Witch
Last Activity: Sep 11 '13, 07:42 AM
Joined: Oct 2 '12
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Thanks.
    ***
    (Project = Studies)
    See more | Go to post

    Leave a comment:


  • I think you nailed it all right, and now I know what I was missing.

    And I checked your code rather thoroughly, even adding one more else-if after the braces of the first one with a new condition. The program went on that line all right and printed that sentence too when that condition was fulfilled.

    What I was missing was, that now there are TWO elses in the same program, one is in the braces that responds to the "if"...
    See more | Go to post

    Leave a comment:


  • "Most part" = Then it doesn't work. Plus, after a fix for THAT scenario, a fix would be needed for when the month is greater than the birth month.

    But I think the main thing that escapes your attention is that the code does not go past the FIRST nested else-if in the first place... as told in the very first post.

    Thanks for your replies, but I think the code won't work anyway, and you can see that for yourself....
    See more | Go to post

    Leave a comment:


  • Well, closing comments on how or why your code doesn't work.
    ***
    See more | Go to post

    Leave a comment:


  • Any closing comments?
    ***
    See more | Go to post

    Leave a comment:


  • And by the way, one may give as many conditions as they want using Logical Operators, AND use as many logical operators too:
    Code:
    if (condition && condition || condition) action;
    etc.
    ***
    See more | Go to post

    Leave a comment:


  • Ahem... Passengers, Attention Please:
    Since DonBock has written everything in accordance with Rabbit (instead of me), and Rabbit has solved the code, passengers are requested to get down of the Dev-CPP Airlines, especially the latest one, since it is only this airline that does not take their route. Since otherwise, they must have tested their route in their airlines (without which they will never give an official statement releasing their...
    See more | Go to post

    Leave a comment:


  • Then know that this is exactly what is happening when we use your style. You can't say a code is working because most conditions work, and one or two don't.


    Why does not my code account for this? Which other scenarios can you think of in the last "else" that remains? So you completely ignored this "else". And that has been your problem throughout.


    It is not about RECOMMENDATION. The question...
    See more | Go to post

    Leave a comment:


  • Okay then forget it.

    As far as accounting for days after the birthday is concerned, then according to you, if someone is using such a program, and last month was his birthday, then no result would be fine, right? And by the way, why should someone account for days BEFORE his birthday if not after his birthday? Because, whatever days are there AFTER his birthday, are also the days BEFORE his NEXT birthday!!!

    To anyone else...
    See more | Go to post

    Leave a comment:


  • Okay. Here is the deal.

    You test the code in the following way:

    Consider that last month was your birthday and today is any date past your birth month. Now input the details in the program, and then see the result.

    You do this step, and then you'll know what I am saying.

    Thanks
    See more | Go to post

    Leave a comment:


  • I am so sorry I did not test it, and your best answer had to be reverted.

    That post got edited; though I have explained more clearly what you did not understand.

    Well it suddenly struck me and I tested and there it was, not giving anything.

    You might want to edit your post too in accordance with the edits.

    Thanks
    See more | Go to post

    Leave a comment:


  • I think "if (condition && condition)" is the only option to fulfill all the conditions in such a code. Plus it is going to work smoothly and remain short too. If you still think it is possible in the style your are saying Rabbit, then you might want to post the code itself. Though I think not.

    Thanks
    See more | Go to post

    Leave a comment:


  • Well yeah, that is common all right, but only in a three conditions, when day may be less, may be equal, or may be bigger than the birth day, and month equal to the birth month in all the three. But there will be a problem if today's month is BIGGER than the birth month. Because the first else-if condition implies that today's month be EQUAL to the birth month. Your style works till that point.

    What's more is, say even if this code had...
    See more | Go to post

    Leave a comment:


  • Well then, it can't be done, since that is not what is required: the first condition of the first else-if is not common to the every set henceforth.
    See more | Go to post

    Leave a comment:


  • H! WeaknessForCats

    Thanks for replying, but I think now this is off the topic in this thread. Since we already resolved the title of this thread, I made a new thread here:
    http://bytes.com/topic/c/answers/948...if#post3745814.
    Please paste your reply there.

    Thanks
    See more | Go to post

    Leave a comment:


  • Nested Else-Ifs Do Not Go Beyond The First Else-if

    Now here is a wonderful code I made, that tells your age the same as was on your last birthday TILL one day before of your birthday (so computer-like no? but I too happen to think that way when it comes to age!). But, as you can see, the nested else-ifs don't go beyond the first else-if level. And I think this SHOULD work, especially when the first nested else-if works. (Nutty C++.)

    One has to resort to if (condition && condition)...
    See more | Go to post
    Last edited by Niheel; Apr 5 '13, 07:15 AM. Reason: This thread is closed. Please be more respectful of members who have spent years contributing and helping. They are trying their best to understand you, which believe it or not after reading yours p

  • Ah, forgot to mention one thing though. Well, I discovered it today. Same kind "if" code was not working with "else" that day, but I did not understand this.

    Even if you place too many conditions with ifs before an action, an "else" would need one and ONLY one "if" to work, or it won't work. So rest of the ifs would need be in a brace set starting second condition.

    And as it seems,...
    See more | Go to post

    Leave a comment:


  • Just for the info:
    That example with "if<condition>& &<condition> " is given in the Operators chapter in its section, only, with emphasis on something else inserted into it (but still easily derivable, if one understands what is being said there).

    Now that I will have separate documents even for each section and with all the experimenting in progress, you can say I discovered this number in range-code...
    See more | Go to post

    Leave a comment:


  • Well, your code confused me a little. So I modified mine the same way you did (you may have given a few extra braces in fact), and now the nesting works fine. So I think the mistake was, giving more than one condition before a brace. Giving more than one condition before a brace somehow breaks the continuity of the program. This had occurred to me yesterday, but I did not try. But I would have tried it later anyway.
    Code:
    int a, b, c;
    cout
    ...
    See more | Go to post

    Leave a comment:


  • Hey DivideBy0,

    After saying that c becomes dependent on a and b, you have given the same nested code that I had given, AND which was NOT working in this manner. You gave it by mistake I guess.

    Because your second example is working perfect. I think && operators are the way if one has to go the nested way. Because then conditions can be met from up to down order, if that is what is required. This can't happen...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...