c program

help in assignment..

Page 1 of 1

2 Replies - 1668 Views - Last Post: 03 October 2008 - 08:14 PM Rate Topic: -----

#1 yuentong   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 03-October 08

c program

Post icon  Posted 03 October 2008 - 07:56 PM

I am taking a c programming and I am new at this. I am doing an assignment with the question as below:

"Write a C program that prompt the user for his or her date of birth,
before determining his or her Western Zodiac Sign.
The program must remain in an infinite loop
(prompt the user for his or her date of birth again, after each display of the previous result)
until a unique key is pressed, indicating that the user wishes to exit the program."

I am not sure that I have all the components in for I still don't get this course. Here is what I have. Can someone look at it and give some advice in what I should do for next?

thanks.

#include<stdio.h>
void main()
{
	int month;
	int day;
	int WZS(int day,int month);


	printf("Please enter your month of birth:\n");
	scanf("%d",&month);
	printf("Please enter your day of birth:\n");
	scanf("%d",&day);

	do
	{
		if((day>=22)&&(day<=31)&&(month==12))
			printf("Your western zodiac sign are Capricorn\n");
		else if((day>=1)&&(day<=20)&&(month==1))
			printf("Your western zodiac sign are Capricorn\n");
		else if((day>=21)&&(day<=31)&&(month==1))
			printf("Your western zodiac sign are Aquarius!\n");
		else if((day>=1)&&(day<=21)&&(month==2))
			printf("Your western zodiac sign are Aquarius\n");
		else if((day>=22)&&(day<29)&&(month==2))
			printf("Your western zodiac sign are Pisces\n");
		else if((day>=1)&&(day<=21)&&(month==3))
			printf("Your western zodiac sign are Pisces\n");
		else if((day>=22)&&(day<=31)&&(month==3))
			printf("Your western zodiac sign are Aries\n");
		else if((day>=1)&&(day<=20)&&(month==4))
			printf("Your western zodiac sign are Aries\n");
		else if((day>=21)&&(day<=30)&&(month==4))
			printf("Your western zodiac sign are Taurus\n");
		else if((day>=1)&&(day<=21)&&(month==5))
			printf("Your western zodiac sign are Taurus\n");
		else if((day>=22)&&(day<=31)&&(month==5))
			printf("Your western zodiac sign are Gemini\n");
		else if((day>=1)&&(day<=21)&&(month==6))
			printf("Your western zodiac sign are Gemini\n");
		else if((day>=22)&&(day<=30)&&(month==6))
			printf("Your western zodiac sign are Cancer\n");
		else if((day>=1)&&(day<=22)&&(month==7))
			printf("Your western zodiac sign are Cancer\n");
		else if((day>=23)&&(day<=31)&&(month==7))
			printf("Your western zodiac sign are Leo\n");
		else if((day>=1)&&(day<=22)&&(month==8))
			printf("Your western zodiac sign are Leo\n");
		else if((day>=23)&&(day<=31)&&(month==8))
			printf("Your western zodiac sign are Virgo\n");
		else if((day>=1)&&(day<=22)&&(month==9))
			printf("Your western zodiac sign are Virgo\n");
		else if((day>=23)&&(day<=30)&&(month==9))
			printf("Your western zodiac sign are Libra\n");
		else if((day>=1)&&(day<=23)&&(month==10))
			printf("Your western zodiac sign are Libra\n");
		else if((day>=24)&&(day<=31)&&(month==10))
			printf("Your western zodiac sign are Scorpio\n");
		else if((day>=1)&&(day<=21)&&(month==11))
			printf("Your western zodiac sign are Scorpio\n");
		else if((day>=22)&&(day<=30)&&(month==11))
			printf("Your western zodiac sign are Sagittarius\n");
		else if((day>=1)&&(day<=21)&&(month==12))
			printf("Your western zodiac sign are Sagittarius\n");
		else
			printf("Wrong data!\n");
	} while(WZS!=e);

}



Is This A Good Question/Topic? 0
  • +

Replies To: c program

#2 MorphiusFaydal   User is offline

  • D.I.C Lover
  • member icon

Reputation: 44
  • View blog
  • Posts: 1,376
  • Joined: 12-May 05

Re: c program

Posted 03 October 2008 - 08:01 PM

You have already posted this here: http://www.dreaminco...wtopic66004.htm

Please don't double post.

And to answer your question: Does it compile and run and give output like it's supposed to? If not, what errors/unexpected functionality are you getting? We may be able to help you with those.
Was This Post Helpful? 0
  • +
  • -

#3 yuentong   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 03-October 08

Re: c program

Posted 03 October 2008 - 08:14 PM

sorry..
actually i compile already but didnt get what i want.
The program must remain in an infinite loop
until a unique key is pressed to exit the program.
but i cant make it..
sorry ya..
actually i dont realy know how to explain..
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1