C#帮助请我是新手 [英] C# Help Please I'm a newbie

查看:55
本文介绍了C#帮助请我是新手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家都不知道即时消息是否在正确的位置,但是事情就这样了.我是编程新手,对于新项目,我正在开发文件管理程序,但不知道从哪里开始.
我正在使用C#控制台!
以下是规格!


•显示欢迎信息和操作菜单(见下文).

•显示当前文件夹.最初应该是文件夹"C:\ Windows".

•提示用户选择以下操作之一:

1.完整文件列表:显示当前文件夹中所有文件的文件名和长度.目录列表的格式应如下所示:

文件位于:C:\ Windows
1. explorer.exe(2871808)
2. ODBC.ini(376)
3. winhlp32.exe(9728)
...
2.过滤文件列表:要求用户提供文件过滤器,并仅显示当前文件夹中与该过滤器匹配的文件.过滤器的示例可能是"* .exe",它仅显示以.exe结尾的文件(*匹配任何文件名,因此该过滤器以英语读取为以.exe结尾的任何文件名").显示的格式应与完整文件列表的格式相同,除了您还应显示所使用的过滤器.

3.文件夹统计信息:显示有关当前文件夹中所有文件的以下统计信息.在这种情况下,请不要列出任何文件.
文件位于:C:\ Windows
档案总数:49
所有文件的总大小:7121424字节
最大文件:explorer.exe,2871808字节
平均文件长度:145335字节

4.退出,退出程序


预先表示非常感谢.

Hi all don''t know if im in the right place but here goes. Im new with programming and for new project I am developing a file management program but dont have a clue where to start.
IM USING C# CONSOLE!
BELOW ARE THE SPECS!


• Display a welcome message and a menu of operations (see below).

• Display the current folder. Initially should be the folder "C:\Windows".

• Prompt the user to select one of the operations:

1. Full File Listing: Display the filenames and lengths of all the files in the current folder. The format for the directory listing should be like this:

Files in: C:\Windows
1. explorer.exe (2871808)
2. ODBC.ini (376)
3. winhlp32.exe (9728)
...
2. Filtered File Listing: ask the user for a file filter and display only the files in the current folder that match that filter. An example of a filter might be "*.exe", which only shows the files ending with .exe (* matches any filename, so this filter reads in English as "any filename ending in .exe"). The display should be formatted in the same way as the full file listing, except you should also display the filter used.

3. Folder Statistics: Display the following statistics about all the files in the current folder. Do not list any files in this case.
Files in: C:\Windows
Total files: 49
Total size of all files: 7121424 bytes
Largest file: explorer.exe, 2871808 bytes
Average file length: 145335 bytes

4. Quit, to exit the program


Big thanks in advance.

推荐答案

不知道从哪里开始.
对于如此明显的作业问题,建议您回到笔记中,学习有关创建程序,打印消息,从用户处获取输入以及使用列出文件详细信息所需的各种文件和目录功能的知识.通过Google或直接在MSDN中都很难找到所有这些.通过付出一些努力并展示您的尝试,您可能会发现人们更愿意提供帮助,但是没人会为您编写该程序.
don''t have a clue where to start.
For such an obvious homework question this suggests that you should go back to your notes and study the bits about creating a program, printing messages, getting input from the user, and using the various file and directory functions necessary to list file details. None of this is too difficult to find either via Google or direct in MSDN. By making some effort and showing what you have tried you may find people are more willing to help, but no one is going to write this program for you.


从这里开始

http://msdn.microsoft.com/en-us/library/0wc2kk78 (v = vs.90).aspx [
Start here

http://msdn.microsoft.com/en-us/library/0wc2kk78(v=vs.90).aspx[^]


要求似乎很简单.您应该认真对待它们,并自己完成所有操作.

除了只是一个简直愚蠢的:

The requirements seem straightforward. You should meed them and do it all by yourself.

Except just one which is simply idiotic:

一位 无脑 老师写道:
A brainless teacher wrote:

显示当前文件夹.最初应该是文件夹"C:\ Windows".

Display the current folder. Initially should be the folder "C:\Windows".

您始终可以打印当前的工作目录,但是此要求的另一部分没有意义,因为开发人员无法决定当前目录是什么. 它由用户定义,并且仅由用户定义.即使可执行文件目录可以是"C:\ Windows",用户也可以像这样运行它:

You can always print current working directory, but the other part of this requirement makes no sense because this is not up to the developer to decide what the current directory is. It is defined by the user and only by the user. Even though the executable directory can be "C:\Windows", the user can run it like this:

cd "\Documents and Settings\VasiaPupkin\"
c:\Window\StupidApplication.exe



并且工作目录将是"\ Documents and Settings \ VasiaPupkin"或其他任何内容.此外,将第三方开发的可执行文件放入"C:\ Windows"被视为非法.尝试在Windows 7不在管理员组中且没有管理员权限的情况下执行此操作,然后查看会发生什么情况.

不,不,那可能只是您老师的一个随机错误,但这使要求无法满足.

也许在这里您正在得到改变,以训练软件开发中最重要的技能之一:如何说话并避免造成损害.您应该了解这个问题,然后再回头给老师,解释这个问题,并说服她(他)无法满足此要求,因此她(他)将解决此作业.一位好老师应该对此表示赞赏,而那些也许不值得教的人.

那么,您认为这很困难吗?欢迎来到工程界!

—SA



and the working directory will be "\Documents and Settings\VasiaPupkin" or anything. Moreover, putting a third-party developed executable to "C:\Windows" is considered illegal. Try to do it in Windows 7 not being in an Administrators group and not having administrator''s privileges and see what happens.

No, no, that could be just a random mistake of your teacher, but it makes the requirements impossible to meet.

Perhaps here you are getting a change to train one of most important skills in software development: how to speak up and avoid doing a damage. You should understand this problem, go back to you teacher, explain this problem and convince her/him that this requirements cannot be met, so she/he would fix this assignment. A good teacher should appreciate that, and the one who would not maybe not deserves to teach.

So, do you think it''s difficult? Welcome to engineering world!

—SA


这篇关于C#帮助请我是新手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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