猜测生日日期

猜测生日日期

源码

#include <iostream>
using namespace std;
int main()
{
	int date = 0;//date to be determind
	char answer;

	//prompt the user for set 1
	cout << "Is your birth date in this set ?" << endl;
	cout << "16 17 18 19\n" <<
		    "20 21 22 23\n" <<
		    "24 25 26 27\n" <<
		    "28 29 30 31" << endl;
	cout << "Enter N for No and Y for Yes:";
	cin >> answer;
	if (answer == 'Y')
		date += 16;
	//Prompt the user for Set 2
	cout << "Is your birth date in this set ?" << endl;
	cout << "8 9 10 11\n" <<
		    "12 13 14 15\n" <<
		    "24 25 26 27\n" <<
		    "28 29 30 31" << endl;
	cout << "Enter N for No and Y for Yes:";
	cin >> answer;
	if (answer == 'Y')
		date += 8;
	//prompt the user for Set 3
	cout << "Is your birth date in this set ?" << endl;
	cout << "1 3 5 7\n" <<
		    "9 11 13 15\n" <<
			"17 19 21 23\n" <<
			"25 27 29 31" << endl;
	cout << "Enter N for No and Y for Yes:";
	cin >> answer;
	if (answer == 'Y')
		date += 1;
	//prompt the user for Set 4
	cout << "Is your birth date in this set ?" << endl;
	cout << "2 3 6 7\n" <<
		"10 11 14 15\n" <<
		"18 19 22 23\n" <<
		"26 27 30 31" << endl;
	cout << "Enter N for No and Y for Yes:";
	cin >> answer;
	if (answer == 'Y')
		date += 2;
	//prompt the user for Set 5
	cout << "Is your birth date in this set ?" << endl;
	cout << "4 5 6 7\n" <<
		"12 13 14 15\n" <<
		"20 21 22 23\n" <<
		"28 29 30 31" << endl;
	cout << "Enter N for No and Y for Yes:";
	cin >> answer;
	if (answer == 'Y')
		date += 4;

	cout << "Your birth date is" << date << endl;

	system("pause");

	return 0;

}

相关推荐

  1. 猜测生日日期

    2024-04-08 10:48:01       36 阅读
  2. 数字猜测游戏

    2024-04-08 10:48:01       45 阅读
  3. 四边形循环与生命的关系猜想

    2024-04-08 10:48:01       43 阅读
  4. 猜测Tomcat如何实现WebSocket协议

    2024-04-08 10:48:01       23 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-08 10:48:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-08 10:48:01       101 阅读
  3. 在Django里面运行非项目文件

    2024-04-08 10:48:01       82 阅读
  4. Python语言-面向对象

    2024-04-08 10:48:01       91 阅读

热门阅读

  1. 正则表达式

    2024-04-08 10:48:01       32 阅读
  2. 基于Docker 快速搭建EFK日志中心

    2024-04-08 10:48:01       32 阅读
  3. 利用python抓取小说,爬虫抓取小说

    2024-04-08 10:48:01       30 阅读
  4. 关于APP分发,要取得更好效果需要注意的

    2024-04-08 10:48:01       33 阅读
  5. 深入浅出 -- 系统架构之负载均衡Nginx跨域配置

    2024-04-08 10:48:01       35 阅读
  6. 前后端接口写法(传输数据)

    2024-04-08 10:48:01       35 阅读
  7. Teamcenter 修改缓存文件夹名称及路径的方法

    2024-04-08 10:48:01       69 阅读
  8. css 手写返回箭头

    2024-04-08 10:48:01       35 阅读
  9. 【告警监控】监控,巡检和拨测

    2024-04-08 10:48:01       36 阅读
  10. Unity LayoutRebuilder 强制UI重新布局

    2024-04-08 10:48:01       32 阅读
  11. wpf viewmodel和界面双向通知

    2024-04-08 10:48:01       27 阅读
  12. tx-lcn使用

    2024-04-08 10:48:01       32 阅读
  13. WPF —— FromTo/By动画

    2024-04-08 10:48:01       32 阅读
  14. C#WPF控件Menu详解

    2024-04-08 10:48:01       30 阅读
  15. Springboot启动过程

    2024-04-08 10:48:01       34 阅读