且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

需要帮助3个编程元素。谢谢!

更新时间:2023-11-20 14:45:40

ok

这个问题并不难。实际上它很容易。

i会给你如何回答这个问题的提示


- 你不需要字符串标记器,因为字符串标记符用于分隔字符串中的单词

例如

string s =" hey你好吗?

a字符串标记符可以分开每个单词

所以你可以将它们存储在字符串中然后如何等等...


- 从文件中读取使用getline( )函数,然后将其存储在数组中..

在while循环中读取文件并说,虽然文件不在最后

这样做,所以所以

然后将输入与存储在数组中的信息进行比较


我希望它很好


祝你好运


问候

hsn
ok
this problem is not hard. actually it is very easy one.
i will give you HINTS in how to answer this question

-you don''t need a string tokenizer, because a string tokenizer is used to seperate words in a string
For an example
string s="hey how are you"
a string tokenizer could seperate each word
so you can store hey in a string and then how and so on...

- to read from the file use a getline() function and then store it in the array..
read the file in a while loop and say , while the file is not in the end
do so and so and so
and then compare the input with the information that you stored in the arrays

I hope it was good

Good LUCK

regards
hsn



Ok我正在为我的计算机编程课程开设Hall Pass程序。有三件事我很困惑。


1.读取文件。


2.从文件读取数据并且把它放到一个数组中。


3.一种访问数组的方法,并检查它是否与用户输入的内容相匹配(如登录程序)


这是文本文件的样子(除非你有一个更简单/更有效的方法,我正在阅读某个地方,关于tokenizer'虽然我不完全理解如何使用它们。)


0002525325

John

00234234

Chris

43244232

Mark


所以,基本上我想让程序做的是,用户输入一个id号码。检查文本文件,如果输入的id号等于其中一个,则显示其名称。


最后,我只是想说,我不想让你为我写这个程序,我只需要帮助,我需要一个地方开始,我需要了解我的意思我真的在做。


下面是我认为可能有用的代码

Ok I am working on a Hall Pass program for my computer programming class. There are 3 things that I am confused on.

1. Reading a file.

2. Taking that data read from the file and putting it into an array.

3. A way to access the array, and check if it matches what the user inputed (like a login program)

This is what the text file looks like (unless you have a easier / more efficient way of doing it, I was reading somewhere, about tokenizer''s although I don''t completely understand how to use them.)

0002525325
John
00234234
Chris
43244232
Mark

So, basically what i want the program to do is, the user enters a id number. The text file is checked and if the id number that is entered equals one of these then their name is displayed.

Lastly, I just want to say, i DO NOT want you to write this program for me, I just need help, i need a place to start, i need to understand what I am actually doing.

Heres some code that i think might help

展开 | 选择 | Wrap | 行号



ok

这个问题并不难。实际上它很容易。

i会给你如何回答这个问题的提示


- 你不需要字符串标记器,因为字符串标记符用于分隔字符串中的单词

例如

string s =" hey你好吗?

a字符串标记符可以分开每个单词

所以你可以将它们存储在字符串中然后如何等等...


- 从文件中读取使用getline( )函数,然后将其存储在数组中..

在while循环中读取文件并说,虽然文件不在最后

这样做,所以所以

然后将输入与存储在数组中的信息进行比较


我希望它很好


祝你好运


问候

hsn
ok
this problem is not hard. actually it is very easy one.
i will give you HINTS in how to answer this question

-you don''t need a string tokenizer, because a string tokenizer is used to seperate words in a string
For an example
string s="hey how are you"
a string tokenizer could seperate each word
so you can store hey in a string and then how and so on...

- to read from the file use a getline() function and then store it in the array..
read the file in a while loop and say , while the file is not in the end
do so and so and so
and then compare the input with the information that you stored in the arrays

I hope it was good

Good LUCK

regards
hsn



我希望你意识到这是Java (不是C ++)论坛。

I hope you realize that this the Java (not C++) forum.