C Exercise Example 50

100 Classic C Examples

Title:Application exercise of #include.

Program analysis:None.

Program source code:

The test.h file code is as follows:

#define LAG >
#define SMA <
#define EQ ==

Main file code:

//  Created by www.example.com on 15/11/9.
//  Copyright © 2015年 Example. All rights reserved.
//

#include "test.h"  
#include <stdio.h>

int main()
{
    int i=10;
    int j=20;
    if(i LAG j)
        printf("%d 大于 %d \n",i,j);
    else if(i EQ j)
        printf("%d 等于 %d \n",i,j);
    else if(i SMA j)
        printf("%d 小于 %d \n",i,j);
    else
        printf("没有值。\n");
    return 0;
}

The output result of the above example is:

10 小于 20 

100 Classic C Examples

other extensions