C字符串滚动,分页和段落 [英] C string scrolling, paging and paragraph

查看:69
本文介绍了C字符串滚动,分页和段落的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人有一种在屏幕上打印字符串的算法,如果该段中的屏幕不适合该单词,那么分页(向上和向下滚动)会切掉该单词吗?

Does anyone have an algorithm of printing strings in a screen, that does the paging (scroll up and down) cuts the word if it doesn''t fit in the screen in that paragraph and so on?

推荐答案

我几年前也做过类似的事情...这是一次大学作业...

数组就是答案...

您将必须创建一个小型解析器:

阅读单词(找到空格,逗号或其他不是字母的单词),计算找到的字符数直到最后一次,检查行中还剩下多少个字符...决定怎么做并显示出来...

您应该从一个位置开始显示文本...此位置应该是一个数组索引...该索引应根据您要查看的页面"而改变...

HTH ...
I made something similar years ago... it was a college assignment...

Arrays are the answer...

you will have to create a small parser:

read the word (find a space, comma or anything that is not a letter) count the chars found till the last time, check how many chars are left in the line you are.. .decide what to do and show it...

You should start showing the text from one position... this position should be one array index... that index should change depending on the "page" you want to see...

HTH...


是的,我自己编写了代码.没关系.我只是问是否有人知道类似的东西,所以我可以退房.但是没关系.现在就可以运行了.

谢谢
Yeah I wrote the code myself. And it is ok. I was just asking if anyone knew something similar so I can check out. but anyay. Its up and running now.

thanks


这篇关于C字符串滚动,分页和段落的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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