visual c++ - C++ if statements in windows forms -


i'm trying make program tells zodiac sign.i have 2 text boxes day , month , button , , richtextbox output. cannot if statements work, richtextbox shows same thing every input . example says capricorn if day 5 , month 7. so, how can make if statements work? i'm new c++ windows forms, , visual studio, , know it's useless program, want know how these things work. here code inside button:

private: system::void button1_click(system::object^  sender, system::eventargs^  e) {     string ^ input = textbox2->text;     string^inputday = textbox1->text;     int luna; int day;     luna = convert::toint32(input);     day = convert::toint32(inputday);     {if (luna == 1 && day < 20)      {         richtextbox1->text = "your sign capricorn ";     }     else { richtextbox1->text = "your sign aquarius"; }}       {   if (luna == 2 && day < 19) { richtextbox1->text = "your sign aquarius"; }     else { richtextbox1->text = "your sign pisces"; }}       if (luna == 3 && day < 21) { richtextbox1->text = "your sign pisces"; }     else { richtextbox1->text = "your sign aries"; }      if (luna == 4 && day < 21) { richtextbox1->text = "your sign aries"; }     else {         richtextbox1->text = "your sign taurus";     }     if (luna == 5 && day < 22) { richtextbox1->text = "your sign taurus"; }     else {         richtextbox1->text = "your sign gemeni";     }      if (luna == 6 && day < 22) {         richtextbox1->text = "your sign gemeni";     }     else { richtextbox1->text = "your sign cancer"; }      if (luna == 7 && day < 22) {         richtextbox1->text = "your sign cancer";     }     else {         richtextbox1->text = "your sign leo";     }      if (luna == 8 && day < 23) {         richtextbox1->text = "your sign leo";     }     else {         richtextbox1->text = "your sign virgo";     }      if (luna == 9 && day < 23) {         richtextbox1->text = "your sign virgo";     }     else {         richtextbox1->text = "your sign libra";     }      if (luna == 10 && day < 23) {         richtextbox1->text = "your sign libra";     }     else { richtextbox1->text = "your sign scorpio"; }      if (luna == 11 && day < 22) {         richtextbox1->text = "your sign scorpio";     }     else {         richtextbox1->text = "your sign sagittarius";     }     if (luna == 12 && day < 22) {         richtextbox1->text = "your sign sagittarius";     }     else {         richtextbox1->text = "your sign capricorn";     } 

it not problem in c++, problem in logic of if statements

it should this:

if (luna == 1)     if (day < 20)        //assign value     else         //assign value else if (luna == 2)     if (day < 19)         //assign value     else         //assign value else if (luna == 3) //and on..... 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -