Earn by twitter on twivert

Sign up for PayPal and start accepting credit card payments instantly.
Showing posts with label macro expansion. Show all posts
Showing posts with label macro expansion. Show all posts

Tuesday, September 14, 2010

WAP to Multiple line in macros expansion


/*WAP to Multiple line in macros expansion*/
/* Program to draw horizontal & vertical line */
#include<stdio.h>
#include<conio.h>
#define HLINE   for ( i = 0 ; i < 79 ; i++ ) \  
                             printf ( "%c", 196 ) ;

#define VLINE( X, Y )  {\gotoxy ( X, Y ) ; \
       printf ( "%c", 179 ) ; \
     }
main( )
{
 int  i, y ;
 clrscr( ) ;

 gotoxy ( 1, 12 ) ;
 HLINE

 for ( y = 1 ; y < 25 ; y++ )
  VLINE ( 39, y ) ;
 getch();
}


WAP to Macros expansion with arguments


/*WAP to Macros expansion with arguments */
/* Program to test whether entered character is digit */
#define ISDIGIT(y) ( y >= 48 && y <= 57 )
main( )
{
 char  ch ;

 printf ( "Enter any digit " ) ;
 scanf ( "%c", &ch ) ;

 if ( ISDIGIT ( ch ) )
  printf ( "\nYou entered a digit" ) ;
 else
  printf ( "\nIllegal input" ) ;
       getch();
} 


WAP to use Macros expansion with arguments


/*WAP to use Macros expansion with arguments */
#include<stdio.h>
#include<conio.h>
#define AREA(x) ( 3.14 * x * x )
main( )
{
 float  r1 = 6.25, r2 = 2.5, a ;
 
 a = AREA ( r1 ) ;
 printf ( "\nArea of circle = %f", a ) ;
 a = AREA ( r2 ) ;
 printf ( "\nArea of circle = %f", a ) ;
       getch();
}

WAP to # define statement used to replace entire C statement


/*WAP to # define statement used to replace entire C statement */
#include<stdio.h>

#define FOUND printf ( "The Yankee Doodle Virus" ) ;
main( )
{
 char  signature ;

 if ( signature == 'Y' ) 
  FOUND
 else
  printf ( "Safe... as yet !" ) ;
 getch();
}


WAP to Nested macro expansion


/*WAP to Nested macro expansion*/
#include<stdio.h>
#include<conio.h>
#define AND &&
#define ARANGE ( a > 25 AND a < 50 )
main( )
{
 int  a = 30 ;

 if ( ARANGE )
  printf ( "within range" ) ;
 else
  printf ( "out of range" ) ;
 getch();
}

WAP to use Macro expansion Logical operator


/*WAP to use Macro expansion Logical operator*/
#include<stdio.h>
#include<conio.h>
#define AND &&
#define OR  ||
main( )
{
 int  f = 1, x = 4, y = 90 ;

 if ( ( f < 5 ) AND ( x <= 20 OR y <= 45 ) )
  printf ( "\nYour PC will always work fine..." ) ;
 else
  printf ( "\nIn front of the maintenance man" ) ;
 getch();
}

WAP to Use of macro expansion2


/*WAP to Use of macro expansion*/
#include<stdio.h>
#include<conio.h>
#define PI  3.1415
main( )
{
 float  r = 6.25 ;
 float  area ;

 area = PI * r * r ;
 printf ( "\nArea of circle = %f", area ) ;
 getch();
}

WAP to Use of macro expansion


/*WAP to Use of macro expansion*/
#include<stdio.h>
#include<conio.h>
#define UPPER 25
main( )
{
 int  i ;
 for ( i = 1 ; i <= UPPER ; i++ )
  printf ( "\n%d", i ) ;
}

ADS

How to earn online

How to earn online:
Step - 1 :
signup for PayPal, to recieve your online earning
click here:
https://www.paypal.com/in/mrb/pal=CZ7224TZBMCBL
step - 2 : Singup these 4 sites & earn & enjoy! Read site to know how to earn.
1. trekpay
Earn up to $0.02 (2 cents) per click.
http://www.trekpay.com/?ref=34690
2. neobux
Earn up to $0.02 (2 cents) per click.
Click here:
http://www.neobux.com/?r=Moneyearner786

AddMe

Bookmark and Share