题目:编写一个程序,要求:发出一声警报,然后打印下列文本
Startled by the sudden sound , Sally shouted ,
"By the Great Pumkin,what was that!"
分析题目:发出一声警报,需要用到 \a ,而下面要输出 “ ” 用 \" \" 转义引号 使其成为普通的字符。
代码:
/*编写一个程序,要求:发出一声警报,然后打印下列文本*/
/* Startled by the sudden sound , Sally shouted ,
"By the Great Pumkin,what was that!" */
#include<stdio.h>
int main(void)
{
printf("\aStartled by the sudden sound,Sally shouted,\n");
printf("\"By the Great Pumkin,what was that!\"");
return 0;
}
执行结果: