如何获取代码中的特定行...需要帮助 [英] How to get a specific line in a Code... Need Help

查看:62
本文介绍了如何获取代码中的特定行...需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C ++有时会像我的下一个问题一样令人困惑

我需要在文件中获得一个特定的行

说文件降水有这个内部

C++ gets confusing sometimes just like my next problem
I need to get a specific line in the file
Say File Precipitation has this inside

展开 | 选择 | Wrap | 行号

推荐答案

Fir3Bat-


你知道下面会有多少件物品吗?每月?如果这是固定的,你可以读取所有内容以分隔变量,然后当你fout或cout时,不要包含endl或\ n这样你就可以显示每个月,然后是下一行,每个月的第一个项目等...


如果你真的想进入格式化,我会建议看看C printf()函数。
Fir3Bat-

Do you know how many items will be below each month? If that is fixed, you can read everything in to separate variables, and then when you fout or cout, just not include the endl or "\n" so that you can display each month, then on the next line, the first item from each month, etc...

If you really want to get into the formatting, I would suggest looking at the C printf() function.


谢谢,看看那个


所以说如果我想要fin>> sMonth 5次

我应该使用什么mod ???

n%? ==?
so say if i want to fin >> sMonth 5 times
what mod should i use???
n%? == ?


这篇关于如何获取代码中的特定行...需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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