Neeraj Mishra

A crazy computer and programming lover. He spend most of his time in programming, blogging and helping other programming geeks.

C++ program to swap two numbers using macros

#include<iostream.h> #include<conio.h> #define SWAP(a,b) {int temp; temp=a; a=b; b=temp;} void main() { clrscr(); int x,y; cout<<“Enter two numbers:”; cin>>x>>y; cout<<“x=”<<x<<” y=”<<y; SWAP(x,y); cout<<“nx=”<<x<<” y=”<<y; getch(); }

C++ program to enter a number and print it into words

#include<iostream.h> #include<conio.h> void once(int a) { switch(a) { case 1: cout<<“One”; break; case 2: cout<<“Two”; break; case 3: cout<<“Three”; break; case 4: cout<<“Four”; break; case 5: cout<<“Five”; break; case 6: cout<<“Six”; break; case 7: cout<<“Seven”; break; case 8: cout<<“Eight”; break; case 9: cout<<“Nine”; break; } } int tens(int a,int b) { int flag=0; switch(a) { …

C++ program to enter a number and print it into words Read More »