#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调试器” 执行