C Program to Insert an Element in an Array

Here is the simple C program to insert an element in a one dimensional array. The array should be in ascending order.   Output Enter size of array:6 Enter the array in ascending order: 1 2 4 5 6 7 Enter element to insert:3 Array after inserting element:1 2 3 4 5 6 7

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 »