占星术程序c++
Astrology Program for C++
基本上家庭作业的问题是做一个占星术程序。然后还有一个部分让我感到困惑:"然后增强你的程序,这样如果生日离相邻的星座只有一两天的距离,程序就会宣布生日在一个‘尖峰’上,并输出与该星座相邻的星座运程。"这个程序将有一个很长的多路分支。为每个星座画一个星座运势。"
这是我目前为止写的:
#include <iostream>
using namespace std;
int main()
{
int month, day;
char ans, space;
do
{
cout << "Please Enter the Month of your Birthday Follow by the Day(ex. 12/01): n";
cin >> month >> space >> day ;
if((month == 3 && day >= 21)||(month==4 && day <= 19))
{
cout << "You Are an Aries! n";
}
else if((month == 4 && day >= 20)||(month==4 && day <= 20))
{
cout << "You Are an Taurus! n";
}
else if((month == 5 && day >= 21)||(month==6 && day <= 21))
{
cout << "You Are an Gemini! n";
}
else if((month == 6 && day >= 22)||(month==7 && day <= 22))
{
cout << "You Are an Cancer! n";
}
else if((month == 7&& day >= 23)||(month==8 && day <= 22))
{
cout << "You Are an Leo! n";
}
else if((month == 8&& day >= 23)||(month==9 && day <= 22))
{
cout << "You Are an Virgo! n";
}
else if((month == 9&& day >= 23)||(month==10 && day <= 22))
{
cout << "You Are an Libra! n";
}
else if((month == 10&& day >= 23)||(month==11 && day <= 21))
{
cout << "You Are an Scorpio! n";
}
else if((month == 11&& day >= 22)||(month==12 && day <= 21))
{
cout << "You Are an Saggitarius! n";
}
else if((month == 12&& day >= 22)||(month==1 && day <= 19))
{
cout << "You Are an Capricorn! n";
}
else if((month == 1&& day >= 20)||(month==2 && day <= 18))
{
cout << "You Are an Aquarius! n";
}
else if((month == 2&& day >= 19)||(month==3 && day <= 20))
{
cout << "You Are an Pisces! n";
}
cout << "Would You life to Find Another Horoscope? (Please Type y or Y)n ";
cin >> ans;
} while(ans == 'y' || ans == 'Y');
cout << " Good Bye!n";
system("PAUSE");
return 0;
}
坦率地说,问题中你不理解的部分与编程无关,因此你需要稍微深入了解一下占星术方面的细节。
看看这些链接,看看你是否能理解这个问题。
http://en.wikipedia.org/wiki/Cusp_%28astrology%29它基本上增加了一个简单的条件,如果出生日期在两个太阳星座之间,它位于一个尖端,你也需要解决这个条件。
,完成。我觉得你需要自己编码。这样你就会学到东西。在SO上发帖之前,也试着谷歌一下。这是一个很好的学习方式。
希望有帮助。
相关文章:
- Mongodb c++驱动程序:如何查询元素的数组
- C++,系统无法执行指定的程序
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- 在VS代码中交叉编译Windows与Linux上的MinGW的SDL程序
- C++ Windows 驱动程序MSB3030无法复制该文件,因为它找不到
- 重载操作程序时出错>>用于类中的字符串 memebr
- 获取日期异步信号安全吗?如果在信号处理程序中使用,它会导致死锁吗
- 试图在visual studio上用C++创建一个桌面应用程序
- 模板元程序查找相似的连续类型名称
- FFmpeg:制作一个应用程序比直接使用ffmepg更好吗
- 如何通过cpp程序运行shell脚本
- 有没有什么方法可以使用一个函数中定义的常量变量,也可以由c++中同一程序中的其他函数使用
- IPC使用多个管道和分支进程来运行Python程序
- 如何将c++程序的一些输出传递给shell,以便在shell中使用
- 使用C++程序合并排序没有得到正确的输出
- 基于boost的程序的静态链接——zlib问题
- 程序崩溃并显示"std::out_of_range"错误
- 在C应用程序中运行C++(带有STL)函数
- 使用mongocxx驱动程序时包含头文件问题
- 如何在c++程序中找到函数的地址