stuck with switch in c project i was trying to write a project in C but it is not working  can someone tell me why? and what do i need to change? i am trying to recive the day in week the birthday of a man will be next year after he tell me the date in this year( example 14/11 day 2(monday)  #include&lt;stdio.h&gt;  int day,month,day_in_week;  void main() {     printf("Enter the date of your birthday in 2015 (day,month, day in week):\n");     scanf("%d%d%d",&amp;day,&amp;month,&amp;day_in_week);     if(day_in_week&lt;1 || day_in_week&gt;7)    {        printf("Error date entered");        return;    }    if(month&lt;1 || month&gt;12)    {        printf("Error date entered");        return;    }    switch(month)    {    case 2:        if(day&lt;1 || day&gt;28)               {                   printf("Error date entered");                   return;               }    case 1: case 3:case 5:case 7:case 8:case 10:case 12:        if(day&lt;1 || day&gt;31)               {                   printf("Error date entered");                   return;               }    case 4:case 6:case 9:case 11:        if(day&lt;1 || day&gt;30)               {                   printf("Error date entered");                   return;               }    }     switch(month)    {    case 1:case 2:            day_in_week++;            if (day_in_week&gt;7)                day_in_week= day_in_week-7;    case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:               day_in_week=day_in_week+2;            if (day_in_week&gt;7)                day_in_week= day_in_week-7;    }     switch(day_in_week)    {    case 1:        printf("Sunday");    case 2:        printf("Monday");    case 3:        printf("Tuesday");    case 4:        printf("Wednesday");    case 5:        printf("Thursday");    case 6:        printf("Friday");    case 7:        printf("Saturday");    }    getch();    return 0; }
Why was the switch statement designed to need a break? Given a simple switch statement  switch (int) {     case 1 :     {         printf("1\n");         break;     }      case 2 :      {         printf("2\n");     }      case 3 :      {         printf("3\n");     } }   The absence of a break statement in case 2, implies that execution will continue inside the code for case 3. This is not an accident; it was designed that way. Why was this decisions made? What benefit does this provide vs. having an automatic break semantic for the blocks? What was the rationale?
Why are there only derivatives to the first order in the Lagrangian? Why is the Lagrangian a function of the position and velocity (possibly also of time) and why are dependences on higher order derivatives (acceleration, jerk,...) excluded?  Is there a good reason for this or is it simply "because it works". Limit with inverse trignometry We have to find the value of $$\lim_{n\to \infty}\sum_{k=2}^n\arccos\left(\frac{1+\sqrt{(k-1)k(k+1)(k+2)}}{k(k+1)}\right)$$  I tried it a lot but could not find any start.   Please help me in this . show that every continuous real-valued function defined on $S_{\mathbb{\Omega}}$ is eventually constant How do I prove that a graph is a topological manifold Good and easy way to share files on local machine I would like to have a directory that has following properties:    Many users can copy files into it  These files can be deleted/changed by these users (user A can delete/modify file that was copied into this directory)    it cant be done using normal file permissions (because permissions are retained on copy).  Here is what I found on the net:        Some use cases:    Sharing music on local machine  Simple git repository sharing (just make a bare repository writeable to many people) --- i know that there are solutions like gitosis Allow many developers to modify test instance of php app without giving them root (i guess they would copy files) --- I'm leading a team of nonprofit junior developers and I need to keep that one simple!    EDIT  AFAIK setting SGID bit is not enugh, it only affects newly created files --- and basic workflow for these use cases ivnolves copying and other operations (which cleave file's gid unchanged) Pointer to class data member "::*" I came across this strange code snippet which compiles fine:  class Car {     public:     int speed; };  int main() {     int Car::*pSpeed = &amp;Car::speed;     return 0; }   Why does C++ have this pointer to a non-static data member of a class? What is the use of this strange pointer in real code? Proof that $\suṃ̣_{k=1}^{n}k {n \choose k}$ for $n \in \mathbb N$ is equal to $n2^{n-1}$.  As a hint I got that $k {n \choose k} = n {n-1\choose k-1} $.  I tried solving this by induction but, in the inductive step I'm not arriving to the correct result. Creating a node fitting the horizontal width of two other nodes I have the two PGF nodes foo and bar positioned in a row.  \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document}   \begin{tikzpicture}[node distance=0.2cm,mynode/.style={rectangle,draw}]     \node[mynode] (foo)                {foo};     \node[mynode] (bar) [right=of foo] {bar};   \end{tikzpicture} \end{document}   How can I create a third node below those two nodes with the width of foo, bar and the node distance between them? Is there a way to do this with the fit library or is this the wrong approach? If I have a 18-55mm lens, is there a point in buying a 35mm prime lens? I recently came across an IE7 only bug that I thought I'd share so when I come to this site 6 months from now to figure out the same thing, I'll have it on hand.   I believe the easiest way to recreate this bug would be the following html in a page with a declared doctype (it works correctly in "quirks mode" / no-doctype):  &lt;div style="overflow: auto; height: 150px;"&gt;     &lt;div style="position: relative;"&gt;[...]&lt;/div&gt; &lt;/div&gt;   In IE7, the outer div is a fixed size and the inner div is relatively positioned and contains more content (assuming the inner div causes an overflow). In all other browsers, this seems to work as expected.  Screenshot: Newer "mainline" versions of the kernel are available from the , e.g. 3.4 and 3.5, while Ubuntu 12.04 is on 3.2.   What are the mainline kernels? Are they better than my existing kernel? What are the pros and cons of upgrading to a mainline kernel? Will I easily be able to go back? What's the intuition behind "stiff systems"? $(\frac 3p)$ is the Legendre symbol here, not a fraction, if that wasn't clear.  This is what I have so far:  We know by Gauss's Lemma that $(\frac qp) = (-1)^v$ where $$v = \#\left\{1 \le a \le \frac{p-1}{2} \mid aq \equiv k_a \pmod{12}),\space -p/2 &lt; k_a &lt; 0\right\}$$  And we also know that multiples of $(\dfrac{p-1}{2}) \times 3$ must be between $0$ and $p/2$, between $p/2$ and $p$, or between $p$ and $3p/2$.   Representing $p$ as $12k + r$ seems like the next step, but I'm not sure where to go from there. I'm a C++ guy learning Java. I'm reading Effective Java and something confused me. It says never to write code like this:  String s = new String("silly");   Because it creates unnecessary String objects. But instead it should be written like this:  String s = "No longer silly";   Ok fine so far...However, given this class:  public final class CaseInsensitiveString {     private String s;     public CaseInsensitiveString(String s) {         if (s == null) {             throw new NullPointerException();         }         this.s = s;     }     :     : }  CaseInsensitiveString cis = new CaseInsensitiveString("Polish"); String s = "polish";    Why is the first statement ok? Shouldn't it be   CaseInsensitiveString cis = "Polish"; How do I make CaseInsensitiveString behave like String so the above statement is OK (with and without extending String)? What is it about String that makes it OK to just be able to pass it a literal like that? From my understanding there is no "copy constructor" concept in Java? Why am I constantly running out of space on my Galaxy S2? How to copy the contents of a file in UNIX without displaying the file contents. I don't want to cat or vi to see the contents.  I want to copy them to clipboard so that I can paste it back on my windows notepad.  I can't copy the file from that server to another due to access restrictions. $\sin \frac{1}{x}$ is not uniformly continuous on $[1, \infty]$ Let $K$ be a field and $f(x)\in K[x]$. Prove that $K[x]/(f(x))$ is a field if and only if $f(x)$ is irreducible in $K[x]$. Let $K$ be a field and $f(x)\in K[x]$. Prove that $K[x]/(f(x))$ is a field if and only if $f(x)$ is irreducible in $K[x]$.   How to prove? I really have no idea... Thank you a lot. I was wondering, how can I create a timeline exactly like this one:    on LaTeX?  I am a Finance student, and write all of my notes using LaTeX. These timelines, are giving me a headache. Since we use a lot of different timelines because of annuities. I want to learn how to create one basic timeline, so that I can then change anything I want. But basically, I want something like this, with the arrows and everything.  Thank you so much guys! How does a wavefunction collapse into one state? More specifically, what conditions cause a wavefunction for a quantum particle to collapse?    Does this have to do with density matrices?    Please try to give a mathematical explanation that is simple and concise...