数组到多个数组 [英] array into multiple arrays

查看:122
本文介绍了数组到多个数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个字符串数组,用于保存从文件中读取的数据。

它包含76行。



我想要什么do是将它们存储在不同的数组中。

喜欢从第21行到第31行1阵列。第31至41个阵列。我该怎么办... plz help

i have a string array which keeps data which read from a file.
it consists 76 lines.

what i want to do is store those in different arrays.
like from 21st line to 31st line in 1 array. and 31st to 41st one array. how can i do it... plz help

推荐答案

问题是,你必须循环遍历字符串中的每个键( char * 或其他..)并搜索换行符(可能''\ n'' s)并继续计算它们。如果换行计数是10的倍数(或者你想要的任何数字),你可以将这10行放在一个新的字符串数组中。
The thing is, you have to loop through every key in the string (char* or something..) and search for line-feeds (probably ''\n''s) and keep counting them. If the line-feed count is a multiple of 10 (or whatever number you want), You put those 10-lines in a new string array.


这篇关于数组到多个数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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