编写一个 C 程序来处理使用函数和循环的语句!
问题
C语言程序中如何根据指定的长度将长行打印成两条或多条短行?
解决方案
让我们编写一个代码来读取一个长行并根据程序中提到的大小打印成两个或多个短行。
我们在这个程序readline()函数中使用的内置函数用于将文本存储在数组中并返回行的大小。
我们用来阅读短句的逻辑解释如下-
while((charcter=readtext())>0){
if(charcter>length){
count=0;
a=0;
while(a我们用来阅读长句的逻辑解释如下-
for(i=0;i程序
以下是使用函数和循环处理语句的C程序-
#include
#define MAX 100
int readtext(void);
char msg[MAX];
const int length=30;
int main(){
int a,b,count,charcter;
printf("enter the statement:\n");
while((charcter=readtext())>0){
if(charcter>length){
count=0;
a=0;
while(a输出结果输出如下-
enter the statement:
Hi Welcome to nhooo .It is one of the biggest platform where you can find all types of study materials with a very good and validate content,students can get there solutions in this platform
Hi Welcome to nhooo
.It is one of the biggest
platform where you can find all
types of study
materials with a very good
and validate content,students
can get there solutions in
this platform
热门推荐
10 感谢父母的简短祝福语
11 家长祝福语大全简短内容
12 春季祝福语女生文案简短
13 庆双节祝福语简短
14 生日祝福语大全女生简短
15 给婴儿祝福语简短的话
16 妹妹生日祝福语简短唯美
17 学生开学季祝福语简短
18 圣诞饭店祝福语大全简短