标题:可变输出字节程序
只看楼主
bear2010
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2009-11-9
结帖率:100%
 问题点数:0 回复次数:0 
可变输出字节程序
#include <stdio.h>
int main(void)
{
 int first_name_width,second_name_width;
 char first_name[20];
 char second_name[30];
 printf("please enter your second name;\n");
 scanf("%s",second_name);
 printf("please enter your first name;\n");
 scanf("%s",first_name);
 printf("please enter your first name width and second name width:\n");
 scanf("%d,%d",&first_name_width,&second_name_width);
 printf("%s %s\n",first_name,second_name);
 printf("%*d %*d\n",first_name_width,strlen(first_name),
 second_name_width,strlen(second_name));
 printf("%s %s\n",first_name,second_name);
 printf("%-*d %-*d",first_name_width,strlen(first_name),
 second_name_width,strlen(second_name));
 getch();
}
输出形式:
搜索更多相关主题的帖子: 输出 可变 字节 
2009-11-15 11:03



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-292353-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.067866 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved