2009年10月13日 星期二

程式語言 第五課 part2

/*
* ======================================================================
* Print Days of the work week and weekend
*
* Copyright (C) 1998 by Mark Austin and David Mazzoni.
*
* This software is provided "as is" without express or implied warranty.
* Permission is granted to use this software on any computer system,
* and to redistribute it freely, subject to the following restrictions:
*
* 1. The authors are not responsible for the consequences of use of
* this software, even if they arise from defects in the software.
* 2. The origin of this software must not be misrepresented, either
* by explicit claim or by omission.
* 3. Altered versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
* 4. This notice is to remain intact.
*
* Written by : David Mazzoni.
* ======================================================================
*/

#include

int main( void ) {
enum day { Sun = 1, Mon, Tue, Wed, Thur, Fri, Sat };
enum day eDay;

eDay = Sun;
printf("Day %4d is on the weekend\n", eDay);
eDay = Mon;
printf("Day %4d is a work day \n", eDay);
eDay = Tue;
printf("Day %4d is a work day \n", eDay);
eDay = Wed;
printf("Day %4d is a work day \n", eDay);
eDay = Thur;
printf("Day %4d is a work day \n", eDay);
eDay = Fri;
printf("Day %4d is a work day \n", eDay);
eDay = Sat;
printf("Day %4d is on the weekend\n", eDay);
}

沒有留言:

張貼留言