当前位置:网站首页>字符串 - 7. 输出字符串 (10 分)C语言标准函数库中 printf 函数和 puts 函数都可以输出字符串,但各有优点和缺点。我们综合两者的优点,设计一个函数来输出字符串。
字符串 - 7. 输出字符串 (10 分)C语言标准函数库中 printf 函数和 puts 函数都可以输出字符串,但各有优点和缺点。我们综合两者的优点,设计一个函数来输出字符串。
2022-04-22 20:18:00 【Tomatos_baby】
C语言标准函数库中 printf 函数和 puts 函数都可以输出字符串,但各有优点和缺点。我们综合两者的优点,设计一个函数来输出字符串。
函数原型
int PutStr(const char *str);
说明:str 为字符串的起始地址。函数将输出 str 所指示的字符串,不自动换行。函数值为输出字符的数目。
裁判程序
#include <stdio.h>
int PutStr(const char *str);
int main()
{
char a[1024];
int n;
gets(a);
n = PutStr(a);
printf("(%d)\n", n);
return 0;
}
/* 你提交的代码将被嵌在这里 */
输入样例
John
输出样例
John(4)
int PutStr(const char *str)
{
printf("%s",str);
int number=0;
while(*str)
{
number++;
str++;
}
return number;
}
版权声明
本文为[Tomatos_baby]所创,转载请带上原文链接,感谢
https://blog.csdn.net/Tomatos_baby/article/details/124324828
边栏推荐
- Cannot proceed because system tables used by Event Scheduler were found damaged
- 396. Rotation function (mathematical law + iterative method)
- CVPR 2022: is smile recognition also sexist? Zhejiang University and Wuhan University jointly set up a fairness improvement framework
- IAP之boot实现
- Recommended chrome plug-ins
- 什么是浏览器同源策略?
- 文件上传问题记录
- 应届毕业生的头一份工作有多重要?
- 顶测科技整理转行过程中一定要避免的问题
- How to execute stored procedures in Navicat?
猜你喜欢

Module 4 operation

In 2022, the most underestimated function of postman, the efficiency of automated interface testing, is simply invincible

396. Rotation function (mathematical law + iterative method)

启动kingbase单机服务时报错:invalid value for parmeter “bindcpulist”:”0-95”

看大网站如何玩转网站加速(CDN)的秘密

Conditions for judging whether plastic deformation occurs: Von Mises yield criterion

Industry trends are far more important than efforts -- top test technology summary

行业趋势远比努力更重要--顶测科技总结

Postman tests the correct posture of array, list and map input APIs

Activity result API usage and source code analysis
随机推荐
Don't say, "I don't like development, so I choose testing."
Timestamp conversion
mysql经纬度 某半径长度 内查询数据
Swift 扩展的使用
年薪170W阿里P8相亲要求女方月薪1万,网友:有点高
Selenium automatic pop-up processing
解决金仓数据库KingbaseES对pg模式的单机数据库插入数据时,出现日志打印的问题
Activity Result API 使用与源码分析
FTP的主动模式和被动模式
Add / remove / filter / sort array elements
[unity / C] the game has a regional collapse and a deep international pit
See how big websites play the secret of website acceleration (CDN)
How to break the midlife crisis? Internet people look at it
Conditions for judging whether plastic deformation occurs: Von Mises yield criterion
行业趋势远比努力更重要--顶测科技总结
How to execute stored procedures in Navicat?
An error occurs when starting Kingbase stand-alone service: invalid value for parmeter "bindpuplist": "0-95"
day29
Swift 协议的使用
IAP之boot实现