Question

C++ Programming Help: Horoscope Signs and Elements

x.øi5="lblDescription">Write an astrology program. The user types ina birthday, and the program responds with the sign and horoscope forthat birthday. The month maybe entered as a number from 1 to 12. Thenenhance your program so that if the birthday is only one or two daysaway from an adjacent sign, the program announces that thebirthday ison a "cusp" and also outputs the horoscope for that nearest adjacentsign. This program will have a long multiway branch. Make up ahoroscope for each sign.Your program should include a loop that letsthe user repeat this calculation until the user says she or he is done.
The horoscope signs and dates are :
Aries March 21-April 19
Taurus April 20-May 20
Gemini May 21-June 21
Cancer June 22-July 22
Leo July 23-August 22
Virgo August 23-September 22
Libra September 23-October 22
Scorpio October 23-November 21
Sagittarius November 22-December 21
Capricorn December 22-January 19
Aquarius January 20-February 18
Pisces February 19-March 20
Horoscope Signs of the same Element are most compatible. There are 4 Elements in astrology, and 3 Signs in each: FIRE (Aries, Leo, Sagittarius) EARTH (Taurus, Virgo,Capricorn) AIR (Gemini, Libra, Aquarius) WATER (Cancer, Scorpio, Pisces)
According to some astrologers, you are most comfortable with your own sign and the other two signs in your Element. For example, Aries would be most comfortable withother Aries and the two other FIRE signs, Leo and Sagittarius.

For the first one:
My problem is that I don't know how to formulate a loop process to reiterate the program. My conditions are probably wrong somewhere, and I just simply don't know whatto do anymore to create that loop. So please help with the loop process there.

#include <iostream.h>
#include <conio.h>

int main()
{
int month;
int day;
char ans;

cout << "Wanna know your horoscope sign?n"
<< "Use this program to find out!nn";
cout << "Enter an integer for the month of your birthday: ";
cin >> month;
cout << "Enter the day of that month: ";
cin >> day;
cout << endl;

do
{
switch (month)
{
case 1:
if (day < 20)
cout << "Your sign is CAPRICORN!n";
else
cout << "Your sign is AQUARIUS!n";
break;
case 2:
if (day < 19)
cout << "Your sign is AQUARIUS!n";
else
cout << "Your sign is PISCES!n";
break;
case 3:
if (day < 21)
cout << "Your sign is PISCES!n";
else
cout << "Your sign is ARIES!n";
break;
case 4:
if (day < 20)
cout << "Your sign is ARIES!n";
else
cout << "Your sign is TAURUS!n";
break;
case 5:
if (day < 21)
cout << "Your sign is TAURUS!n";
else
cout << "Your sign is GEMINI!n";
break;
case 6:
if (day < 22)
cout << "Your sign is GEMINI!n";
else
cout << "Your sign is CANCER!n";
break;
case 7:
if (day < 23)
cout << "Your sign is CANCER!n";
else
cout << "Your sign is LEO!n";
break;
case 8:
if (day < 23)
cout << "Your sign is LEO!n";
else
cout << "Your sign is VIRGO!n";
break;
case 9:
if (day < 23)
cout << "Your sign is VIRGO!n";
&nbsõbpx.øi5bsp;else
cout << "Your sign is LIBRA!n";
break;
case 10:
if (day < 23)
cout << "Your sign is LIBRA!n";
else
cout << "Your sign is SCORPIO!n";
break;
case 11:
if (day < 22)
cout << "Your sign is SCORPIO!n";
else
cout << "Your sign is SAGITTARIUS!n";
break;
case 12:
if (day < 22)
cout << "Your sign is SAGITTARIUS!n";
else
cout << "Your sign is CAPRICORN!n";
break;
}
} while (ans == 'y' || ans == 'Y');


getch();
}





For the second problem:
My program doesn't even compile and execute. I have these two errors:
expected primary-expression before "else"and expected `;' before "else"
I don't know what to do. Please help!

#include <iostream.h>
#include <conio.h>

int main()
{
int month;
int day;
char ans;

cout << "Wanna know your horoscope sign?n"
<< "Use this program to find out!nn";
cout << "Enter an integer for the month of your birthday: ";
cin >> month;
cout << "Enter the day of that month: ";
cin >> day;
cout << endl;

do
{
switch (month)
{
case 1:
if (day < 20)
cout << "Your sign is CAPRICORN!n";
cout << "Your element is EARTH!n";
else
cout << "Your sign is AQUARIUS!n";
cout << "Your element is AIR!n";
break;
case 2:
if (day < 19)
cout << "Your sign is AQUARIUS!n";
cout << "Your element is AIR!n";
else
cout << "Your sign is PISCES!n";
cout << "Your element is WATER!n";
break;
case 3:
if (day < 21)
cout << "Your sign is PISCES!n";
cout << "Your element is WATER!n";
else
cout << "Your sign is ARIES!n";
cout << "Your element is FIRE!n";
break;
case 4:
if (day < 20)
cout << "Your sign is ARIES!n";
cout << "Your element is FIRE!n";
else
cout << "Your sign is TAURUS!n";
cout << "Your element is EARTH!n";
break;
case 5:
if (day < 21)
cout << "Your sign is TAURUS!n";
cout << "Your element is EARTH!n";
else
cout << "Your sign is GEMINI!n";
cout << "Your element is AIR!n";
break;
case 6:
if (day < 22)
cout << "Your sign is GEMINI!n";
cout << "Your element is AIR!n";
else
cout << "Your sign is CANCER!n";
cout << "Your element is WATER!n";
break;
case 7:
if (day < 23)
cout << "Your sign is CANCER!n";
cout << "Your element is WATER!n";
else
cout << "Your sign is LEO!n";
cout << "Your element is FIRE!n";
break;
case 8:
if (day < 23)
cout << "Your sign is LEO!n";
cout << "Your element is FIRE!n";
else
cout << "Your sign is VIRGO!n";
cout << "Your element is EARTH!n";
break;
case 9:
if (day < 23)
cout << "Your sign is VIRGO!n";
cout << "Your element is EARTH!n";
else
cout << "Your sign is LIBRA!n";
cout << "Your element is AIR!n";
break;
case 10:
if (day < 23)
cout << "Your sign is LIBRA!n";
cout << "Your element is AIR!n";
else
cout << "Your sign is SCORPIO!n";
cout << "Your element is WATER!n";
break;
case 11:
if (day < 22)
cout << "Your sign is SCORPIO!n";
cout << "Your element is WATER!n";
else
cout << "Your sign is SAGITTARIUS!n";
cout << "Your element is FIRE!n";
break;
case 12:
if (day < 22)
cout << "Your sign is SAGITTARIUS!n";
cout << "Your element is FIRE!n";
else
cout << "Your sign is CAPRICORN!n";
cout << "Your element is EARTH!n";
&nbsùbp˜mx.bsp;break;
}
} while (ans == 'y' || ans == 'Y');


getch(
0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
C++ Programming Help: Horoscope Signs and Elements
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • use python Write a program that asks the user for day and month of a birthday....

    use python Write a program that asks the user for day and month of a birthday. The program then tells the Zodiac signs that will be compatible with that birthday. #Example for Aries The Ram    Mar. 21–Apr. 19 day = 24 # user enters this month = 3 # user enters this if ( month == 3 and day >=21) or (month == 4 and day <= 19): print("You are Aries, Fire group, compatible with Aries, Leo, Sagittarius") Zodiac Signs:...

  • Hello, I am wondering what the source code for this problem would be. Thank you so...

    Hello, I am wondering what the source code for this problem would be. Thank you so much. You will write a java program using the Eclipse IDE. The program will allow a user to perform one of two options. The user can look up the dates for a given zodiac sign or enter a date and find what sign corresponds to that date. SIGN START DATE END DATE Aries 3/21 4/19 Taurus 4/20 5/20 Gemini 5/21 6/20 Cancer 6/21 7/22...

  • QUESTION 6 There are 12 signs of the Zodiac: Aries, Taurus, Gemini, Cancer, Leo, Virgo, Libra,...

    QUESTION 6 There are 12 signs of the Zodiac: Aries, Taurus, Gemini, Cancer, Leo, Virgo, Libra, Scorpio, Sagittarius, Capricorn, Aquarius, and Pisces. Each sign corresponds to a different calendar period of approximately 1 month. Assuming that a person is just as likely to be born under one sign as another, what is the probability that in a group of five people at least two of them were born under the sign of Aries? Da. 0.082 b.0.901 Dc. 0.205 d.0.059 e.0.515...

  • THIS IS FOR C++ PROGRAMMING USING VISUAL STUDIO THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING #inclu...

    THIS IS FOR C++ PROGRAMMING USING VISUAL STUDIO THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING #include "pch.h" #include #include using namespace std; // Function prototype void displayMessage(void); void totalFees(void); double calculateFees(int); double calculateFees(int bags) {    return bags * 30.0; } void displayMessage(void) {    cout << "This program calculates the total amount of checked bag fees." << endl; } void totalFees() {    double bags = 0;    cout << "Enter the amount of checked bags you have." << endl;    cout <<...

  • I need help in my C++ code regarding outputting the enums in string chars. I created...

    I need help in my C++ code regarding outputting the enums in string chars. I created a switch statement for the enums in order to output words instead of their respective enumerated values, but an error came up regarding a "cout" operator on my "Type of Item" line in my ranged-based for loop near the bottom of the code. I tried casting "i.type" to both "i.GroceryItem::Section::type" and "i.Section::type", but neither worked. Simply put, if a user inputs 1 as their...

  • IN C++ Help to fix code Library management program. Error is when i type a letter...

    IN C++ Help to fix code Library management program. Error is when i type a letter into options menu the code breaks. after your edits, the code should still run as normal. CODE: #include<iostream> using namespace std; //structure to store library data class BookDetails{ public: struct library { int code; char title[20]; int status; }; library book_details[100]; }; //structure to store user data class UserDetails:public BookDetails{ public: struct users { int id; char name[20]; int booksNumber; }; users user_details[100]; };...

  • Can I get some help with this question for c++ if you can add some comments...

    Can I get some help with this question for c++ if you can add some comments too to help understand that will be much appreciated. Code: #include <cstdlib> #include <getopt.h> #include <iostream> #include <string> using namespace std; static long comparisons = 0; static long swaps = 0; void swap(int *a, int *b) {     // add code here } void selectionSort(int *first, int *last) {     // add code here } void insertionSort(int *first, int *last) {     // add code here }...

  • C++ Project Modify the Date Class: Standards Your program must start with comments giving your name...

    C++ Project Modify the Date Class: Standards Your program must start with comments giving your name and the name of the assignment. Your program must use good variable names. All input must have a good prompt so that the user knows what to enter. All output must clearly describe what is output. Using the date class, make the following modifications: Make the thanksgiving function you wrote for project 1 into a method of the Date class. It receive the current...

  • c++ programming : everything is done, except when you enter ("a" ) in "F" option ,...

    c++ programming : everything is done, except when you enter ("a" ) in "F" option , it does not work. here is the program. #include <iostream> #include <string> #include <bits/stdc++.h> #include <iomanip> #include <fstream> using namespace std; #define MAX 1000 class Inventory { private: long itemId; string itemName; int numberOfItems; double buyingPrice; double sellingPrice; double storageFees; public: void setItemId(long id) { itemId = id; } long getItemId() { return itemId; } void setItemName(string name) { itemName = name; } string...

  • c++, I am having trouble getting my program to compile, any help would be appreciated. #include...

    c++, I am having trouble getting my program to compile, any help would be appreciated. #include <iostream> #include <string> #include <string.h> #include <fstream> #include <stdlib.h> using namespace std; struct record { char artist[50]; char title[50]; char year[50]; }; class CD { //private members declared private: string artist; //asks for string string title; // asks for string int yearReleased; //asks for integer //public members declared public: CD(); CD(string,string,int); void setArtist(string); void setTitle(string); void setYearReleased(int); string getArtist() const; string getTitle() const; int...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT