Answer the question
In order to leave comments, you need to log in
How to read certain information from txt file (C#)?
I decided to write a bot with which you can just chat.
I developed the algorithm: 1) You write a phrase to the console, the bot accesses a file that contains similar questions (For example,
the
file Sinonims.txt)
questions and answers (Voprosi and Answer.txt)
3) Answers me
How to read, write to a file, etc. I know, but how to scan a file for certain commands - this is already difficult for me.
Answer the question
In order to leave comments, you need to log in
Since you want to work with a text file, you can get by with one file (Voprosi and Answer.txt). There will be the same answers to different questions - it's not scary.
Search: either load the entire file and search for a substring, or read the file line by line.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question