编写一个 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 好听的元旦简短祝福语