i'm a beginner in the world of c++, i'm having a pretty hard analyzing my c++ problem... it's about the Zodiac Sign...
this is the problem:
A group of fung Sui experts’ encountered problem in determining the zodiac sign of their clients. They want to make a program that will compute the year if birth by determining the age of the client. Once the year is being determined, it will prompt automatically the user the zodiac sign of the client and it will also display the characteristics and the fortune of the client.
the output must be this:
Enter the Name: Kirah Hynson
Enter Age: 20
||
**************************************
1988, you were born on the year of the Dragon
characteristics:
Lucky, flexible, eccentric, imaginative, artistic, spiritual, charismatic
it's a very hard problem for me... it's been 2weeks from the day that our class starts.... hope someone helps... have a nice day
i have this.. i don't think this program I made is correct..
#include <iostream>
using namespace std;
int main ()
{
int A, B, C, D, E, F, G, H, I, J, K, L;
char Year, Name, Age, Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Sheep, Monkey, Rooster, Dog, Pig;
char Response;
cout << "Enter your Name: \n";
cin >> Name;
cout << "Enter your Age: \n";
cin >> Age;
if (Year=A)
{
A= 1900&&1912&&1924&&1936&&1948&&1960&&1972&&1984&&1996&&2008&&2020&&Rat;
cout << "What is your birth date? [enter only the year]:\n";
cin >> Year;
cout << "You were born in the Year of the Rat" << A << "\n";
cout << "Characteristics: Intelligent, adaptable, quick-witted, charming, artistic, sociable:\n";
}
else if (Year=B)
{
cout << "What is your birth date? [enter only the year]:\n";
cin >> Year;
B= 1901, 1913, 1925, 1937, 1949, 1961, 1973, 1985, 1997, 2009, 2021, Ox;
cout << "Your were born in the Year of the Ox"<< B << "\n";
cout << "Characteristics: Loyal, reliable, thorough, strong, reasonable, steady, determined:\n";
}
else if (Year=C)
{
cout << "What is your Birth Date? [enter only the year]:\n";
cin >> Year;
C= 1902, 1914, 1926, 1938, 1950, 1962, 1974, 1986, 1998, 2010, 2022, Tiger;
cout << "You were born on the Year of the Tiger"<< C << "\n";
cout << "Characteristics: Enthusiastic, courageous, ambitious, leadership, confidence, charismatic:\n";
}
else if (Year=D)
{
cout << "What is your birth date? [enter only the year]:\n";
cin >> Year;
D= 1903, 1915, 1927, 1939, 1951, 1963, 1975, 1987, 1999, 2011, 2023, Rabbit;
cout << "You were born on the Year of the Rabbit"<< D << "\n";
cout << "Characteristics: Trustworthy, empathic, modest, diplomatic, sincere, sociable, caretakers:\n";
}
else if (Year=E)
{
cout << "What is your birth date? [enter only the year]:\n";
cin >> Year;
E=1904, 1916, 1928, 1940, 1952, 1964, 1976, 1988, 2000, 2012, 2024, Dragon;
cout << "You were born on the Year of the Dragon" << E << "\n";
cout << "Characteristics: Lucky, flexible, eccentric, imaginative, artistic, spiritual, charismatic:\n";
}
else if (Year=F)
{
cout << "What is your birth date? [enter only the year]:\n";
cin >> Year;
F=1905, 1917, 1929, 1941, 1953, 1965, 1977, 1989, 2001, 2013, 2025, Snake;
cout << "You were born on the Year of the Snake" << F << "\n";
cout << "Characteristics: Philosophical, organized, intelligent, intuitive, elegant, attentive, decisive:\n";
}
else if (Year=G)
{
cout << "What is your birth date? [enter only the year]:\n";
cin >> Year;
G=1906, 1918, 1930, 1942, 1954, 1966, 1978, 1990, 2002, 2014, 2026, Horse;
cout << "You were born on the Year of the Horse:" << G << "\n";
cout << "Characteristics: Adaptable, loyal, courageous, ambitious, intelligent, adventurous, strong:\n";
}
else if (Year=H)
{
cout << "What is your birth date? [enter only the year]:\n";
cin >> Year;
H=1907, 1919,1931, 1943, 1955, 1967, 1979, 1991, 2003, 2015, 2027, Sheep;
cout << "You were born on the Year of the Sheep" << H << "\n";
cout << "Characteristics: Tasteful, crafty, warm, elegant, charming, intuitive, sensitive, calm:\n";
}
else if (Year=I)
{
cout << "What is your birth date? [enter only the year]:\n";
cin >> Year;
I=1908, 1920, 1932, 1944, 1956, 1968, 1980, 1992, 2004, 2016, 2028, Monkey;
cout << "You were born on the Year of the Monkey" << I << "\n";
cout << "Characteristics: Quick-witted, charming, lucky, adaptable, bright, versatile, lively, smart:\n";
}
else if (Year=J)
{
cout << "What is your birth date? [enter only the year]:\n";
cin >> Year;
J=1909, 1921, 1933, 1945, 1957, 1969, 1981, 1993, 2005, 2017, 2029, Rooster;
cout << "You were born on the Year of the Rooster" << J << "\n";
cout << "Characteristics: Honest, energetic, intelligent, flamboyant, flexible, diverse, confiden:\n";
}
else if (Year=K)
{
cout << "What is your birth date? [enter only the year]:\n";
cin >> Year;
K=1910, 1922, 1934, 1946, 1958, 1970, 1982, 1994, 2006, 2018, 2030, Dog;
cout << "You were born on the Year of the Dog" << K << "\n";
cout << "Characteristics: Loyal, sociable, courageous, diligent, steady, lively, adaptable, smart:\n";
}
else if (Year=L)
{
cout << "What is your birth date? [enter only the year]:\n";
cin >> Year;
L=1911, 1923, 1935, 1947, 1959, 1971, 1983, 1995, 2007, 2019, 2031, Pig;
cout << "You were born on the Year of the Boar" << L << "\n";
cout << "Characteristics: Honorable, philanthropic, determined, optimistic, sincere, sociable:\n";
}
// cout << "\n";
cout << "Do you want to Quit? [y/n]?\n";
cin >> Response;
}
while (Response == 'y' || Response == 'Y');
#include <iostream>
usingnamespace std;
int main (){
char Name[256], prevName[256];
bool cont;
string Response;
int bYear = 0,
Age,
curYear = 2009;
do{
cout << "Enter your name: ";
cin >> Name;
cout << "Enter your age: ";
cin >> Age;
bYear = curYear - Age;
if (bYear < 1900 | bYear >= curYear){
do{
cout << "Enter your age: ";
cin >> Age;
bYear = curYear - Age;
}while (bYear < 1900 | bYear >= curYear);
}
//Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Sheep, Monkey, Rooster, Dog, Pig;
switch(bYear){
case 1900:
case 1912:
case 1924:
case 1936:
case 1948:
case 1960:
case 1972:
case 1984:
case 1996:
case 2008:
cout << "You were born in the Year of the Rat: " << bYear << "\n";
cout << "Characteristics: Intelligent, adaptable, quick-witted, charming, artistic, sociable:\n";
break;
case 1901:
case 1913:
case 1925:
case 1937:
case 1949:
case 1961:
case 1973:
case 1985:
case 1997:
case 2009:
cout << "Your were born in the Year of the Ox: "<< bYear << "\n";
cout << "Characteristics: Loyal, reliable, thorough, strong, reasonable, steady, determined:\n";
break;
case 1902:
case 1914:
case 1926:
case 1938:
case 1950:
case 1962:
case 1974:
case 1986:
case 1998:
case 2010:
cout << "You were born on the Year of the Tiger: "<< bYear << "\n";
cout << "Characteristics: Enthusiastic, courageous, ambitious, leadership, confidence, charismatic:\n";
break;
case 1903:
case 1915:
case 1927:
case 1939:
case 1951:
case 1963:
case 1975:
case 1987:
case 1999:
case 2011:
cout << "You were born on the Year of the Rabbit: "<< bYear << "\n";
cout << "Characteristics: Trustworthy, empathic, modest, diplomatic, sincere, sociable, caretakers:\n";
break;
case 1904:
case 1916:
case 1928:
case 1940:
case 1952:
case 1964:
case 1976:
case 1988:
case 2000:
case 2012:
cout << "You were born on the Year of the Dragon: " << bYear << "\n";
cout << "Characteristics: Lucky, flexible, eccentric, imaginative, artistic, spiritual, charismatic:\n";
break;
case 1905:
case 1917:
case 1929:
case 1941:
case 1953:
case 1965:
case 1977:
case 1989:
case 2001:
case 2013:
cout << "You were born on the Year of the Snake: " << bYear << "\n";
cout << "Characteristics: Philosophical, organized, intelligent, intuitive, elegant, attentive, decisive:\n";
break;
case 1906:
case 1918:
case 1930:
case 1942:
case 1954:
case 1966:
case 1978:
case 1990:
case 2002:
case 2014:
cout << "You were born on the Year of the Horse: " << bYear << "\n";
cout << "Characteristics: Adaptable, loyal, courageous, ambitious, intelligent, adventurous, strong:\n";
break;
case 1907:
case 1919:
case 1931:
case 1943:
case 1955:
case 1967:
case 1979:
case 1991:
case 2003:
cout << "You were born on the Year of the Sheep: " << bYear << "\n";
cout << "Characteristics: Tasteful, crafty, warm, elegant, charming, intuitive, sensitive, calm:\n";
break;
case 1908:
case 1920:
case 1932:
case 1944:
case 1956:
case 1968:
case 1980:
case 1992:
case 2004:
cout << "You were born on the Year of the Monkey: " << bYear << "\n";
cout << "Characteristics: Quick-witted, charming, lucky, adaptable, bright, versatile, lively, smart:\n";
break;
case 1909:
case 1921:
case 1933:
case 1945:
case 1957:
case 1969:
case 1981:
case 1993:
case 2005:
cout << "You were born on the Year of the Rooster: " << bYear << "\n";
cout << "Characteristics: Honest, energetic, intelligent, flamboyant, flexible, diverse, confiden:\n";
break;
case 1910:
case 1922:
case 1934:
case 1946:
case 1958:
case 1970:
case 1982:
case 1994:
case 2006:
cout << "You were born on the Year of the Dog: " << bYear << "\n";
cout << "Characteristics: Loyal, sociable, courageous, diligent, steady, lively, adaptable, smart:\n";
break;
case 1911:
case 1923:
case 1935:
case 1947:
case 1959:
case 1971:
case 1983:
case 1995:
case 2007:
cout << "You were born on the Year of the Boar: " << bYear << "\n";
cout << "Characteristics: Honorable, philanthropic, determined, optimistic, sincere, sociable:\n";
break;
default:
cout << "Invalid input!";
}
cout << "\n";
cout << "Do you want to Quit? [y/n]?\n";
cin >> Response;
if (Response == "y"){
cont = false;
}elseif (Response == "n"){
cont = true;
}
}while(cont == true);
}