Originally Posted by
spaghetticode
You want to read up on while- and do..while-loops. If your class doesn't use a textbook, you could peek into the tutorial on this very website.
I make this code but I don't know what is the error, still studying the while and do while loops.
Code:
#include<stdio.h>#include<conio.h>
main()
{
int month,date,stop = 0;
do
{
clrscr();
printf("\n Enter your birth month and birth date as a number:");
scanf("%d%d",&month,&date);
i++;
printf("\n\nMore data? -1 to stop, others to continue:");
scanf("%d",&stop);
} while(stop != -1);
if ((month == 1 && date >= 20)||(month == 2 && date <=18))
{
printf("\n \n Your zodiac sign is AQUARIUS");
}
else if (( month == 2 && date >= 19)||( month == 3 && date <= 20))
{
printf("\n \n Your zodiac sign is PISCES");
}
else if (( month == 3 && date >= 21)||( month == 4 && date <= 19))
{
printf("\n \n Your zodiac sign is ARIES");
}
else if (( month == 4 && date >= 20)||( month == 5 && date <= 20))
{
printf("\n \n Your zodiac sign is TAURUS");
}
else if (( month == 5 && date >= 21 )||( month == 6 && date <= 20 ))
{
printf("\n \n Your zodiac sign is GEMINI");
}
else if (( month == 6 && date >= 21 )||( month == 7 && date <= 22 ))
{
printf("\n \n Your zodiac sign is CANCER");
}
else if (( month == 7 && date <= 23 )||( month == 8 && date <= 22))
{
printf("\n \n Your zodiac sign is LEO");
}
else if (( month == 8 && date >= 23 )||( month == 9 && date <= 22 ))
{
printf("\n \n Your zodiac sign is VIRGO");
}
else if (( month == 9 && date >= 23 )||( month == 10 && date <= 22))
{
printf("\n \n Your zodiac sign is LIBRA");
}
else if (( month == 10 && date >= 23 )||( month == 11 && date <= 21))
{
printf("\n \n Your zodiac sign is SCORPIO");
}
else if (( month == 11 && date >= 22 )||( month == 12 && date <= 21))
{
printf("\n \n Your zodiac sign is SAGUITTARIUS");
}
else if (( month == 12 && date >= 22 )||( month == 1 && date <= 19 ))
{
printf("\n \n Your zodiac sign is CAPRICORN");
}
else
{
printf("\n INVALID INPUT");
getch();
return(0);
}