Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. //System Libraries
  2. #include <iostream> //Input/Output Library
  3. #include <string>
  4. using namespace std;
  5.  
  6. //User Libraries
  7.  
  8. //Global Constants, no Global Variables are allowed
  9. //Math/Physics/Conversions/Higher Dimensions - i.e. PI, e, etc...
  10.  
  11. //Function Prototypes
  12.  
  13. //Execution Begins Here!
  14. int main(int argc, char** argv) {
  15. //Set the random number seed
  16.  
  17. //Declare Variables
  18. bool star(string elem[], string sign1); //for loop
  19. string sign1, //Inputs
  20. sign2;
  21.  
  22. //Initialize or input i.e. set variable values
  23. //Setting categories for star signs.
  24. string fire [] = {"Aries", "Leo", "Sagittarius"},
  25. earth [] = {"Taurus","Virgo","Capricorn"},
  26. air [] = {"Gemini","Libra","Aquarius"},
  27. water [] = {"Cancer","Scorpio","Pisces"};
  28.  
  29. //Map inputs -> outputs
  30. cout<<"Horoscope Program which examines compatible signs."<<endl;
  31. cout<<"Input 2 signs."<<endl;
  32. cin >>sign1>>sign2;
  33.  
  34. //Display the outputs
  35.  
  36. if (star(fire, sign1) && star(fire, sign2)){ //If both fire signs.
  37. cout<<sign1<<" and "<<sign2<<" are compatible Fire signs.";
  38. }
  39. else if (star(earth, sign1) && star(earth, sign2)){ //If both earth signs.
  40. cout<<sign1<<" and "<<sign2<<" are compatible Earth signs.";
  41. }
  42. else if (star(air, sign1) && star(air, sign2)){ //If both air signs.
  43. cout<<sign1<<" and "<<sign2<<"are compatible Air signs.";
  44. }
  45. else if (star(water, sign1) && star(water, sign2)){ //If both water signs.
  46. cout<<sign1<<" and "<<sign2<<" are compatible Water signs.";
  47. }
  48. else{ //If signs are not compatible.
  49. cout<<sign1<<" and "<<sign2<<" are not compatible signs.";
  50. }
  51. }
  52.  
  53. bool star(string elem[], string sign1) //loop exists outside of main execution.
  54. {
  55. for (int i = 0; i < 3; i++) //three signs per string
  56. {
  57. if (elem[i] == sign1)
  58. return true;
  59. }
  60. return false;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement