编写一个 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 教师闺蜜祝福语简短