学习电脑 发表于 2016-7-15 09:33:56

C语言

printf("姓名      学号      语文      数学      英语      理综      总分      排名\n");

怎么将输出的内容与上面语句对齐???

小剑剑 发表于 2016-7-15 10:07:21

没学到格式化输出吗?
#include <stdio.h>
int main()
{
    printf("%-8s%-8s%-8s%-8s%-8s%-8s%-8s%-8s\n","姓名","学号","语文","数学","英语","理综","总分","排名");
    printf("%-8s%-8s%-8s%-8s%-8s%-8s%-8s%-8s\n","李佳宇","5428","0","0","1","3","4","鱼c最低");

}

人造人 发表于 2016-7-15 11:25:18

小剑剑 发表于 2016-7-15 10:07
没学到格式化输出吗?

小甲鱼老师怎么惹你了^_^
李佳宇","5428","0","0","1","3","4","鱼c最低

小剑剑 发表于 2016-7-15 11:40:42

人造人 发表于 2016-7-15 11:25
小甲鱼老师怎么惹你了^_^
李佳宇","5428","0","0","1","3","4","鱼c最低

开个玩笑嘛{:10_254:}

人造人 发表于 2016-7-15 15:05:29

小剑剑 发表于 2016-7-15 11:40
开个玩笑嘛

^_^

学习电脑 发表于 2016-7-16 10:07:41

小剑剑 发表于 2016-7-15 10:07
没学到格式化输出吗?

xiexie
页: [1]
查看完整版本: C语言