请帮我 !.用C语言归档 [英] please help me !. file in C language

查看:78
本文介绍了请帮我 !.用C语言归档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

写入功能,
表示一个文本文件中最长行的字符数

谢谢!!!!

write function,
 indicates the number of characters of the longest line in one text file

thank you very much !!!

推荐答案



好像是作业,

我不会给您确切的程序,但会为您提供指导.

您需要阅读每一行并计算字符数,可以将最高字符数存储在一个变量中.如果下次阅读给您提供了更大的字符,那么以前存储的字符将被替换为新的行字符数.这样就完成了所有生产线的过程.

最后,在读取所有行之后,您的变量中的字符数就最多了.

希望对您有帮助,
祝您好运
Hi,

It seems like homework,

I will not give you exact program but i will guide you.

You need to read each line and count the characters, you can store hightest charecter count in one variable. If next read gives you greater characters then previously stored character then replace it with new line character count. this way complete the process for all the line.

Finally after reading all the line you have maximum character count in your variable.

Hope it helps you,
Best luck


您可以通过读取并计算每行中的字符数来做到这一点.使用一个变量,让charcount表示字符计数,将其初始化为0,然后将其值更新为当前行如果字符数大于当前的charcount变量值,则保持字符数不变,否则保持原样.通过这种方式,您可以获取最大字符数行.
You can do this by reading and counting number of character in the each line.take one variable let say charcount for character count intiate it to 0 and then updates its value to current line character count if its character count is greater than current charcount variable value otherwise keep it as it is.By this way you can get max char count line.


这篇关于请帮我 !.用C语言归档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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