CLearn/Chapter_3/3_10_escape.c

19 lines
478 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* 使用转义序列 */
#include <stdio.h>
int main(void)
{
float salary;
printf("\aEnter your desired monthly salary:");
printf(" $_______\b\b\b\b\b\b\b");
//退格只回退光标,不删除字符
scanf("%f", &salary);
printf("\n\t$%.2f a month is $%.2f a year.", salary, salary * 12.0);
//n新起一行t添加一个制表位的空大小
printf("\rGee!\n");
//r使得光标回到起始处
getchar();
getchar();
return 0;
}