帮助检查文件中的字符串并根据它返回值C ++ [英] Help checking a string from a file and returning value based on it C++

查看:79
本文介绍了帮助检查文件中的字符串并根据它返回值C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助检查存储在我的计算机上的文本文件中的字符串..伪示例

I am needing help checking for a string from a text file that is stored on my computer.. pseudo example

if String = x
{
Sleep(100)
}
else
{
exit(0)
}



im只是试图检查文本文件中的一行文本然后返回一个基于该行的值..例如,如果字符串是继续然后我希望它继续退出(0)



我尝试了什么:



注意到这里真的因为我没有太多的知识。


im just trying to check the text file for a line of text then return a value based on that line.. like for example if the string is "continue" then I would like it to continue else exit(0)

What I have tried:

Noting really because I don't have much knowledge here.

推荐答案

你需要学习C ++的基础知识,因为你的代码与问题无关,它甚至不是正确的C ++。

阅读文件是一项通用操作,互联网上有很多例子和很多教程。



我们不做你的家庭作业。

HomeWork不会在乞求别人做你的工作时测试你的技能,它会让你思考和他让您的老师检查您对所学课程的理解以及您应用这些课程时遇到的问题。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

你的任何失败都会帮助你了解什么有效,什么无效,被称为'试错'学习。

所以,试一试,重读课程并开始工作。如果您遇到特定问题,请展示您的代码并解释这个问题,我们可能会提供帮助。
You need to learn the basics of C++ as your code is not remotely related the problem, it is not even correct C++.
reading a file is a generic operation, there is heaps of examples on internet and a lot of tutorials.

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.


这篇关于帮助检查文件中的字符串并根据它返回值C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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