实例七:参与面包店正在打折活动

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hello_world
{
    internal class Program
    {
        static void  Main(string[] args)
        {
            Console.WriteLine("面包店正在打折,活动进行中......");
            Console.Write("请输入星期:");
            string strWeek = Console.ReadLine();                //字符串变量记录,Console.ReadLine()会等待直到用户按下回车,一次读入一行
            Console.Write("请输入时间:");
            int intTime =Convert.ToInt32 ( Console.ReadLine()); //Console.ReadLine()输入的是字符串,Time定义为int需要进行类型转换
            if ((strWeek == "星期三" && (intTime >= 19 || intTime <= 22)) || (strWeek == "星期六" && (intTime >= 17 || intTime <= 20)))
            {
                Console.WriteLine("恭喜您获得了折扣资格,请尽情选购吧!");
            }
            else
            {
                Console.WriteLine("不好意思,您来晚了一步,赠送您20元代金券,期待您的下次光临!");
            }
            Console.ReadLine();//定位控制台
        }
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值