首页 > 其他 > 详细

程序清单4.10_strings.c程序_《C Primer Plus》P73

时间:2018-06-17 00:09:54      阅读:247      评论:0      收藏:0      [点我收藏+]
// strings.cpp : 定义控制台应用程序的入口点。 // /* strings.c -- 字符串的格式化 */ /*     时间:2018年06月16日 23:47:00     代码:程序清单4.10_strings.c程序_《C Primer Plus》P73     目的:%-n.ms 文本左对齐 字段宽度为n, 字符个数为m; */ #include "stdafx.h" #define BLURB "Authentic imitation!"    // 简介 "真实模仿" int _tmain(int argc, _TCHAR* argv[]) {     printf("/%2s/\n", BLURB);     printf("/%24s/\n", BLURB);     printf("/%24.5s/\n", BLURB);     printf("/%-24.5s/\n", BLURB);     getchar();     return 0; } /*     在VS2010中运行结果: ------------------------------------------ /Authentic imitation!/ /    Authentic imitation!/ /                   Authe/ /Authe                   / ----------------------------------------------------     总结:         /Authentic imitation!/            -- %2s         /    Authentic imitation!/        -- %24s         /                   Authe/        -- %24.5s         /Authe                   /        -- %-24.5s ----------------------------------------------------- *


程序清单4.10_strings.c程序_《C Primer Plus》P73

原文:http://blog.51cto.com/13555061/2130108

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!