我该如何工作? [英] How do I make this work?

查看:68
本文介绍了我该如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此人输入他们的DOB。输出他们下一个生日的哪一天。然后创建一个表格,列出他们的生日所在的日子及其完成的次数。我需要一些关于下一步该怎么做的帮助。



我尝试了什么:



Dim dob As Date

Dim beginYear As Integer

Dim rightNow As Date

rightNow = Date.Now

rightNow = rightNow.ToShortDateString

Console.WriteLine(你的生日是什么时候?)

dob = Console.ReadLine()

dob = dob.ToShortDateString

beginYear = DateDiff(DateInterval.Month,birthday,rightNow)

Console.WriteLine(beginYear&months。)

Console.ReadLine()

The person inputs their DOB. Output what day their next birthday will be on. Then create a table of the days their birthday has fallen on and the number of times it has done so. I need some help on what to do next.

What I have tried:

Dim dob As Date
Dim beginYear As Integer
Dim rightNow As Date
rightNow = Date.Now
rightNow = rightNow.ToShortDateString
Console.WriteLine("When is your birthday?")
dob = Console.ReadLine()
dob = dob.ToShortDateString
beginYear = DateDiff(DateInterval.Month, birthday, rightNow)
Console.WriteLine(beginYear & " months.")
Console.ReadLine()

推荐答案

我们不做你的作业:它是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是像你想的那么难!首先将问题看作四个不同的部分:

1)从用户处获取DOB,检查它是否为有效日期,并将其转换为DateTime变量。

2)当它工作时,找出一周中的哪一天 - 这很简单,DateTime结构会告诉你。

3)然后看看明年 - 这也很容易,DateTime有一个AddYear方法。

4)然后创建你的表 - 只是重复到1岁的步骤2和3的组合,并将计数存储在七个元素的数组中,其中每个元素计算特定的一天这一周。



这并不复杂,如果你这样打破它并考虑一下。做一点,测试,修复它,然后继续工作,而不是之前。



如果遇到特定问题,那么请询问这一点,我们将尽力提供帮助。但我们不打算为你做这一切!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think! Start by looking at the question as four different parts:
1) Get the DOB from the user, check it's a valid date, and convert it to a DateTime variable.
2) When that works, find out what day of the week it is - that's simple, the DateTime struct will tell you that.
3) Then look at next year - that's also easy, DateTime has an AddYear method.
4) Then create your table - just a combination of steps 2 and 3 repeated back to age 1, and storing the counts in an array of seven elements where each element counts a specific day of the week.

It's not complicated, if you break it up like that and think about it for a moment. Do one bit, test it, fix it, and move on to the next when you have it working, not before.

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!


这篇关于我该如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆