西西河

主题:谢谢各位了,我自己来行了! -- 锦候

共:💬28 🌺9
全看树展主题 · 分页首页 上页
/ 2
下页 末页
家园 谢谢各位了,我自己来行了!

实在是不好意思,我以为时间不够了,麻烦大家了!不好意思!


本帖一共被 1 帖 引用 (帖内工具实现)
家园 英文,看不懂
家园 我现在就翻译,不过得等一下了,有点事情先得处理一下!

谢谢您帮手了!

家园 我只用过VB6.0
家园 这个应该区别不大吧!没关系,没关系!
家园 一步一步来

建议如下:

1. First step, try to read a text file line by line

2. Use the split() function to put the readings into a string array. From the array, it's easy to find out the upperbound, so you will know how many figures in that line.

3. If you have not trouble doing step 1 and 2, you now can consider use a data structure to hold the readings, such as System.Collections.Generic.Dictionary(Of Integer, String), use the sales person id as the key.

4. Loop through the collection, to perform your calculation.

Good luck with your assignment!

家园 对了,对了,您是高手。您别光给纲领性文件呀!

能不能具体一点,最好给个例子什么的,我对这个vb很不适应。谢谢您了!我看了几个类似的例子,跟着做没什么问题,可自己做就不行了!

家园 疑问:既然能够生成.txt文件,为啥不直接写入数据库,省事多了
家园 这个您得问老师了,我们是刚开始学。

到现在8,9个星期罢了!

家园 del
家园 del
家园 什么地方卡住了?

从简单开始考虑:

第一步,写一个程序,可以读txt文件。先不考虑统计什么的事情,只要读一行行的字符。注意文件结尾符号。

第二步,对每个字符串,想办法把逗号分隔的各个数字读出来。在此基础上区分id和销售额,将销售额加起来。要注意处理最后一个-1。

第三步,现在你有了id和销售额,考虑用什么样的数据结构保存整个表。(自定义结构 or list/array/map etc.看你们上课讲过什么)

第三步,考虑修改你的数据结构,让它可以保存奖金额。然后对表从头到尾过一遍,通过销售额计算奖金。

第四步,修改你上一部的遍历过程,加入统计公司数据的部分。

到这里基本上功能已经完成了,剩下的是考虑输出结果的问题。

编码应该不是很难,不过你自己做比较好,如果碰到问题再来问或者查msdn手册,做一遍下来会有很多收获的。

Good luck!

外链出处

家园 兄台说得对!时间够了,我自己来了!

链接出处

不过还是谢谢您了!花之!

家园 万万不敢当

放狗一大堆例子,不放狗,还可以看看Help Menu -> How Do I....

建议用单独的程序来做第一,第二步,弄清楚了再开一个新的程序把它们合并起来。

'Code Example of reading a text file line by line:

Dim FILE_NAME As String = "C:\test.txt"

Dim objReader As New System.IO.StreamReader(FILE_NAME

Dim TextLine As String

Do While objReader.Peek() <> -1

TextLine = objReader.ReadLine()

Loop

'code example of the split function

Dim str1 As String = "ppp"

Dim str2 As String = "ccc"

Dim str3 As String = "kkk"

Dim strAll3 As String = str1 + ", " + str2 + ", " + str3

Dim strArray() As String = strAll3.Split(",")

The online help of the generic dictionary example is very detailed, you can find an example from there.

Good luck again!

家园 天!我真的已经死了,竟然连放狗都忘了!

不过这个要用什么关键词?

visual basic计算销售额?谢谢了!

还说不是高手?太谦虚了!我动手太晚了!唉!

万圣节快乐!

全看树展主题 · 分页首页 上页
/ 2
下页 末页


有趣有益,互惠互利;开阔视野,博采众长。
虚拟的网络,真实的人。天南地北客,相逢皆朋友

Copyright © cchere 西西河