Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //System Libraries
- #include <iostream> //Input/Output Library
- #include <string>
- using namespace std;
- //User Libraries
- //Global Constants, no Global Variables are allowed
- //Math/Physics/Conversions/Higher Dimensions - i.e. PI, e, etc...
- //Function Prototypes
- //Execution Begins Here!
- int main(int argc, char** argv) {
- //Set the random number seed
- //Declare Variables
- bool star(string elem[], string sign1); //for loop
- string sign1, //Inputs
- sign2;
- //Initialize or input i.e. set variable values
- //Setting categories for star signs.
- string fire [] = {"Aries", "Leo", "Sagittarius"},
- earth [] = {"Taurus","Virgo","Capricorn"},
- air [] = {"Gemini","Libra","Aquarius"},
- water [] = {"Cancer","Scorpio","Pisces"};
- //Map inputs -> outputs
- cout<<"Horoscope Program which examines compatible signs."<<endl;
- cout<<"Input 2 signs."<<endl;
- cin >>sign1>>sign2;
- //Display the outputs
- if (star(fire, sign1) && star(fire, sign2)){ //If both fire signs.
- cout<<sign1<<" and "<<sign2<<" are compatible Fire signs.";
- }
- else if (star(earth, sign1) && star(earth, sign2)){ //If both earth signs.
- cout<<sign1<<" and "<<sign2<<" are compatible Earth signs.";
- }
- else if (star(air, sign1) && star(air, sign2)){ //If both air signs.
- cout<<sign1<<" and "<<sign2<<"are compatible Air signs.";
- }
- else if (star(water, sign1) && star(water, sign2)){ //If both water signs.
- cout<<sign1<<" and "<<sign2<<" are compatible Water signs.";
- }
- else{ //If signs are not compatible.
- cout<<sign1<<" and "<<sign2<<" are not compatible signs.";
- }
- }
- bool star(string elem[], string sign1) //loop exists outside of main execution.
- {
- for (int i = 0; i < 3; i++) //three signs per string
- {
- if (elem[i] == sign1)
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement