如何从文本文件中读取生日和名称列表? [英] How Do I Read In A List Of Birthdays And Names From A Text File?
问题描述
您好!我有一个家庭作业,给我一个带有名单和生日列表的文本文件。例如02/22 George Washington,08/04 Barack Obama等我必须提示用户输入MM / DD格式的日期,然后程序必须返回任何生日的名字(这是读取的)从列表中)。我不知道从哪里开始,因为文件IO是我用C语言编程时最薄弱的部分。谢谢!
这是一个示例运行:
输入日期(MM / DD)或完成:
08/04
以下的人有生日在08/04:
Barack Obama
Hello! I have a homework assignment where i am given a text file with a list of names and birthdays. For example "02/22 George Washington, 08/04 Barack Obama" etc. I have to prompt the user for whichever date in the format MM/DD and then the program has to return the name of whoever's birthday that is(which is read from the list). I don't know where to even begin because File IO is my weakest area when it comes to programming in C. Thank you!
Here's a sample run:
Enter a date (MM/DD) or "DONE":
08/04
The following people have birthdays on 08/04:
Barack Obama
推荐答案
家庭作业不是我们的好处,从这里开始:
http://www.c4learn.com/index/file-handling-in-c/ [ ^ ]
http://www.tutorialspoint.com/cprogramming/c_file_io.htm [ ^ ]
Homework is for your benefit not ours, start here:
http://www.c4learn.com/index/file-handling-in-c/[^]
http://www.tutorialspoint.com/cprogramming/c_file_io.htm[^]
这篇关于如何从文本文件中读取生日和名称列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!