#define SWITCH(S) char *_S = S; if (0) #define CASE(S) } else if (strcmp(_S, S) == 0) {switch(1) { case 1 #define BREAK } #define DEFAULT } else {switch(1) { case 1
int main() { char buf[256]; int i=1,j,i2;
printf(" Postfix and Prefix\n \nString - Enter your string ++i/i++/--i/i--: "); scanf ("%s", buf); printf("Enter the value of i variable:"); scanf ("%d", &i);
SWITCH (buf) { CASE ("++i"): // i = 1; i2=i; j = ++i; //(i is 2, j is 2)
printf ("\ni = %d\n\nj = ++i;\n%d %d\n%(j is %d %,i is %d)",i2,j,i,j,i); BREAK; CASE ("i++"): i2=i; j = i++; //(i is 2, j is 1) printf ("\ni = %d\n\nj = i++;\n%d %d\n%(j is %d %,i is %d)",i2,j,i,j,i);
BREAK;
CASE ("--i"): i2=i; j = --i;
printf ("\ni = %d\n\nj = --i;\n%d %d\n%(j is %d %,i is %d)",i2,j,i,j,i);
BREAK; CASE ("i--"): i2=i; j = i--;
printf ("\ni = %d\n\nj = i--;\n%d %d\n%(j is %d %,i is %d)",i2,j,i,j,i); BREAK;
DEFAULT: printf ("\nPlease enter ++i or ++i or ++i or ++i to know the deferences \n");
hi sir/madam i want so notes about in computer system arch.. and 8085 mp in rajasthan
ReplyDeletehey , do you have notes for java ? URGENT.
ReplyDeleteineed notes for Javas
ReplyDelete///https://www.facebook.com/himel.sarkar.5///
ReplyDelete#include
#include
#define SWITCH(S) char *_S = S; if (0)
#define CASE(S) } else if (strcmp(_S, S) == 0) {switch(1) { case 1
#define BREAK }
#define DEFAULT } else {switch(1) { case 1
int main()
{
char buf[256];
int i=1,j,i2;
printf(" Postfix and Prefix\n \nString - Enter your string ++i/i++/--i/i--: ");
scanf ("%s", buf);
printf("Enter the value of i variable:");
scanf ("%d", &i);
SWITCH (buf) {
CASE ("++i"):
// i = 1;
i2=i;
j = ++i;
//(i is 2, j is 2)
printf ("\ni = %d\n\nj = ++i;\n%d %d\n%(j is %d %,i is %d)",i2,j,i,j,i);
BREAK;
CASE ("i++"):
i2=i;
j = i++;
//(i is 2, j is 1)
printf ("\ni = %d\n\nj = i++;\n%d %d\n%(j is %d %,i is %d)",i2,j,i,j,i);
BREAK;
CASE ("--i"):
i2=i;
j = --i;
printf ("\ni = %d\n\nj = --i;\n%d %d\n%(j is %d %,i is %d)",i2,j,i,j,i);
BREAK;
CASE ("i--"):
i2=i;
j = i--;
printf ("\ni = %d\n\nj = i--;\n%d %d\n%(j is %d %,i is %d)",i2,j,i,j,i);
BREAK;
DEFAULT:
printf ("\nPlease enter ++i or ++i or ++i or ++i to know the deferences \n");
BREAK;
}
getch();
return 0;
}
Helpful notes
ReplyDeletethank you
ReplyDelete