Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,837 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,554 people online right now. Registration is fast and FREE... Join Now!




c program

 
Reply to this topicStart new topic

c program, help in assignment..

yuentong
3 Oct, 2008 - 06:56 PM
Post #1

New D.I.C Head
*

Joined: 3 Oct, 2008
Posts: 17

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.

CODE

#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);

}

User is offlineProfile CardPM
+Quote Post

MorphiusFaydal
RE: C Program
3 Oct, 2008 - 07:01 PM
Post #2

D.I.C Lover
Group Icon

Joined: 12 May, 2005
Posts: 1,111



Thanked: 8 times
Expert In: Hardware, Networking

My Contributions
You have already posted this here: http://www.dreamincode.net/forums/showtopic66004.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.
User is online!Profile CardPM
+Quote Post

yuentong
RE: C Program
3 Oct, 2008 - 07:14 PM
Post #3

New D.I.C Head
*

Joined: 3 Oct, 2008
Posts: 17

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..

User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/3/08 04:50PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month