#include<iostream>
using namespace std;
int main(){
{
Start:
int n,m;
char re;
cout<<"Zodiac Sign[1]"<<endl;
cout<<"Exit[2]"<<endl;
cin>>n;
do{
switch(n)
{
case 1:
int m,d;
cout<<"Please enter your birthday in numerical form:"<<endl;
cin>>m>>d;
if(m==3 && d>=21)
cout<<"Your zodiac sign is ARIES!"<<endl;
else if (m==4 && d<=19)
cout<<"Your zodiac sign is ARIES!"<<endl;
else if(m==4 && d>=20)
cout<<"Your zodiac sign is TAURUS!"<<endl;
else if(m==5 && d<=20)
cout<<"Your zodiac sign is TAURUS!"<<endl;
else if(m==5 && d>=21)
cout<<"Your zodiac sign is GEMINI!"<<endl;
else if(m==6 && d<=20)
cout<<"Your zodiac sign is GEMINI!"<<endl;
else if(m==6 && d>=21)
cout<<"Your zodiac sign is CANCER!"<<endl;
else if(m==7 && d<=22)
cout<<"Your zodiac sign is CANCER!"<<endl;
else if(m==7 && d>=23)
cout<<"Your zodiac sign is LEO!"<<endl;
else if(m==8 && d<=22)
cout<<"Your zodiac sign is LEO!"<<endl;
else if(m==8 && d>=23)
cout<<"Your zodiac sign is VIRGO!"<<endl;
else if(m==9 && d<=22)
cout<<"Your zodiac sign is VIRGO!"<<endl;
else if(m==9 && d>=23)
cout<<"Your zodiac sign is LIBRA!"<<endl;
else if(m==10 && d<=22)
cout<<"Your zodiac sign is LIBRA!"<<endl;
else if(m==10 && d>=23)
cout<<"Your zodiac sign is SCORPIO!"<<endl;
else if(m==11 && d<=21)
cout<<"Your zodiac sign is SCORPIO!"<<endl;
else if(m==11 && d>=22)
cout<<"Your zodiac sign is SAGITTARIUS!"<<endl;
else if(m==12 && d<=21)
cout<<"Your zodiac sign is SAGITTARIUS!"<<endl;
else if(m==12 && d>=22)
cout<<"Your zodiac sign is CAPRICORN!"<<endl;
else if(m==1 && d<=19)
cout<<"Your zodiac sign is CAPRICORN!"<<endl;
else if(m==1 && d>=20)
cout<<"Your zodiac sign is AQUARIUS!"<<endl;
else if(m==2 && d<=18)
cout<<"Your zodiac sign is AQUARIUS!"<<endl;
else if(m==2 && d>=19)
cout<<"Your zodiac sign is PISCES!"<<endl;
else if(m==3 && d<=20)
cout<<"Your zodiac sign is PISCES!"<<endl;
else;
break;
cout<<"invalid output"<<endl;
}
start:
cout<<"Do you want to continue?[Y/N]"<<endl;
cout<<"You must type a 'Y' or an 'N'.\n"<<endl;
cin>>re;
break;
}while(re=='Y'||re=='Y');
1. why do you redeclare the "m" variable inside the loop?
2. I'm not familiar with the "Start:" command you use at the end, so I may be wrong by saying this but, I don't think the last "break" is necessary.
3. while (re=='Y'||re=='Y') you are comparing the same thing here. I think you mean to check for an upper case or a lower case i.e "Y || y" not "Y || Y"
4. It is not clear in your question if the program won't compile or if the loop won't terminate. If is the latter you may want to check you are using upper case when entering "Y" or even better, use "toupper"
skylinerR390: as for as the others I don't know in
2.)I tried to run the program but without the start my loop won't appear so I tried putting start to make my loop appear.
#include<iostream>
usingnamespace std;
int main(){
{
Start:
int n,m;
char re;
cout<<"Zodiac Sign[1]"<<endl;
cout<<"Exit[2]"<<endl;
cin>>n;
do{
switch(n)
{
case 1:
int m,d;
cout<<"Please enter your birthday in numerical form:"<<endl;
cin>>m>>d;
if(m==3 && d>=21)
cout<<"Your zodiac sign is ARIES!"<<endl;
elseif (m==4 && d<=19)
cout<<"Your zodiac sign is ARIES!"<<endl;
elseif(m==4 && d>=20)
cout<<"Your zodiac sign is TAURUS!"<<endl;
elseif(m==5 && d<=20)
cout<<"Your zodiac sign is TAURUS!"<<endl;
elseif(m==5 && d>=21)
cout<<"Your zodiac sign is GEMINI!"<<endl;
elseif(m==6 && d<=20)
cout<<"Your zodiac sign is GEMINI!"<<endl;
elseif(m==6 && d>=21)
cout<<"Your zodiac sign is CANCER!"<<endl;
elseif(m==7 && d<=22)
cout<<"Your zodiac sign is CANCER!"<<endl;
elseif(m==7 && d>=23)
cout<<"Your zodiac sign is LEO!"<<endl;
elseif(m==8 && d<=22)
cout<<"Your zodiac sign is LEO!"<<endl;
elseif(m==8 && d>=23)
cout<<"Your zodiac sign is VIRGO!"<<endl;
elseif(m==9 && d<=22)
cout<<"Your zodiac sign is VIRGO!"<<endl;
elseif(m==9 && d>=23)
cout<<"Your zodiac sign is LIBRA!"<<endl;
elseif(m==10 && d<=22)
cout<<"Your zodiac sign is LIBRA!"<<endl;
elseif(m==10 && d>=23)
cout<<"Your zodiac sign is SCORPIO!"<<endl;
elseif(m==11 && d<=21)
cout<<"Your zodiac sign is SCORPIO!"<<endl;
elseif(m==11 && d>=22)
cout<<"Your zodiac sign is SAGITTARIUS!"<<endl;
elseif(m==12 && d<=21)
cout<<"Your zodiac sign is SAGITTARIUS!"<<endl;
elseif(m==12 && d>=22)
cout<<"Your zodiac sign is CAPRICORN!"<<endl;
elseif(m==1 && d<=19)
cout<<"Your zodiac sign is CAPRICORN!"<<endl;
elseif(m==1 && d>=20)
cout<<"Your zodiac sign is AQUARIUS!"<<endl;
elseif(m==2 && d<=18)
cout<<"Your zodiac sign is AQUARIUS!"<<endl;
elseif(m==2 && d>=19)
cout<<"Your zodiac sign is PISCES!"<<endl;
elseif(m==3 && d<=20)
cout<<"Your zodiac sign is PISCES!"<<endl;
else;
break;
cout<<"invalid output"<<endl;
}
start:
cout<<"Do you want to continue?[Y/N]"<<endl;
cout<<"You must type a 'Y' or an 'N'.\n"<<endl;
cin>>re;
break;
}while(re=='Y'||re=='Y');
return 0;}
}
1. remove start
2. the last "invalid output" message should be put with the last "else". then only put the "break;" and close the switch statement
3. remove the "break" after the cin statement
4. and the 2 'Y' are upper case... 1 should be lowercase