基于visual Studio2013解决C语言竞赛题之0203格式化输出




题目


解决代码及点评

#include <stdio.h>
#include <stdlib.h>
void	main()
{	
        // print是输出函数,参数%s表示输出字符串,而%-10s表示输出的字符串占10个位置,不足则补空格
	printf("%-10s %-10s %-10s %-10s %-10s\n","name","number", "math" , "english" ,"computer");
	printf("%-10s %-10s %-10s %-10s %-10s\n","zhanghua","9901", "80.50" , "87.0" ,"80");
	printf("%-10s %-10s %-10s %-10s %-10s\n","lina","9902", "70.00" , "80.0" ,"90");
	printf("%-10s %-10s %-10s %-10s %-10s\n","wanggang","9903", "87.00" , "76.0" ,"78");


	system("pause");
}

此题主要训练printf格式化输出能力

代码下载及其运行

代码下载链接:

http://download.csdn.net/detail/yincheng01/6640491

解压密码为c.itcast.cn


下载解压后用VS2013打开工程文件 0201.vcxproj

点击 “本地Windows调试器” 执行


程序运行结果






你可能感兴趣的:(基于visual Studio2013解决C语言竞赛题之0203格式化输出)