【发布时间】:2017-01-20 12:46:11
【问题描述】:
虽然我已经解决了我的问题,但是在这样做时我遇到了 \t 的意外行为。在哪里我得到了单个 \t 的不同制表符长度。这是我的代码:
#include<stdio.h>
int calculate_intpart_qutent(int dividend, int diviser);
int main()
{
int a;
int b;
int choice;
do
{
printf("Enter the Dividend (a) :\t");
scanf("%d", &a);
printf("\nEnter the Divisor (b) :\t");
scanf("%d", &b);
printf("\n\nThe quotient is:\t%d", calculate_qutent(a, b));
printf("\n\nDo you want to try again?(Y\\N):\t");
choice = getchar();
if (choice == '\n') choice = getchar();
printf("\n\n\n");
} while (choice=='y'|| choice=='Y');
}
int calculate_intpart_qutent(int dividend, int diviser)
{
return (dividend/diviser);
}
这是我的输出:
由于我在前两个 printf 语句中都使用了单个制表符,为什么我的输出屏幕上的制表符长度不同?我在这里做错了吗?
我正在使用 Visual Studio 2017 RC。
【问题讨论】: