常用的转义序列

#include <stdio.h>

#define QUIT  3

int get_menu_choice( void )
{
    int selection = 0;

    do{
        printf( \n1 - Beep );
        printf( \n2 - Display);
        printf( \n3 - Quit);
        printf( \nEnter: );

        scanf( %d, &selection );

     }while ( selection < 1 || selection > 3 );

     return selection;
}

void print_report( void )
{
     printf( \n\nSequence\tMeaning );
     printf( \n\\a\t\tbell (alert) );
     printf( \n\\b\t\tbackspace );
     printf( \n...\t\t...);
}

int main( void )
{
    int choice = 0;

    while (choice != QUIT)
    {
       choice = get_menu_choice();

       if (choice == 1)
           printf(\nBeeping the computer\a\a\a );
       else
       {
           if (choice == 2)
               print_report();
       }
    }
    printf(Bye!\n);

    return 0;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。