我想打印一下:
printf("please Choose: 1-For Checking what is the most popular number in the array\n 2-To sort your array from the smallest number to the biggest\n 3-To sort your array that even will be to your left and odd to the right\n *Any other number will exit the program\n");
有一种方法可以在'\ n'之后定义空格数而不是输入大量的空格吗?
答案 0 :(得分:3)
尝试:
printf("%Ns\n", "");
其中N
是您要显示的空格数。
这样您就会显示一个以N
空格开头的空字符串。
printf("please Choose: 1-For Checking what is the most popular number in the array\n%8s2-To sort your array from the smallest number to the biggest\n%8s3-To sort your array that even will be to your left and odd to the right\n%8s*Any other number will exit the program\n", "", "", "");