Posts

Featured post

-Write C program to find even and odd number using macro

-Write C program to find even and odd number using macro #include<stdio.h> #define number(n)((n%2==0)?1:0) int main() { int num; printf("enter any number"); scanf("%d",&num); if(number(num)) printf("number is even"); else printf("number is odd"); return 0; } ***************************Output*********************** amr@amrj-virtual-machine:~$ gccevenodd.c amr@samr-virtual-machine:~$ ./a.out enter any number 2 number is evensmj@amr-virtual-machine:~$

Write a c++ program to find the Function overloading example in c++(Addition, Subtraction,Multiplication).

A C++ Program To calculate the example of function overloading: #include<iostream> using namespace std; int fun(); int fun(int a,int b); int fun(int a); int fun() { int a,b; cout<<" Enter the three values:"; cin>>a>>b; cout<<"\n Sum is"<<a+b; return 0; } int fun(int a,int b) { cout<<"\n Subtraction  is:"<<a-b; return 0; } int fun(int a) { cout<<"\n Multiplication is same values:"<<a*a; return 0; } int main() { fun(); fun(10,5); fun(4); return 0; }  Out Put:-  Enter the three values:5 6  Sum is11  Substraction is:5  Multipliaction is same values:16 -------------------------------- Process exited after 3.722 seconds with return value 0 Press any key to continue . . .

Stack in Data structure

      Stack Definition:           Amreshtechknowledge.blogspot.com Stack is a order collection of homogeneous data elements where the insertion and deletion operation take place only one end that is called Stack. It is a LIFO (Last in First out) Technique.  It is a Abstract Data type. The position of stack where the operation is perform is called TOS(Top of Stack).                                                    Stack is Basically there are two operation. Push:-This is a insert or adding element in a stack i.e is called Push. Pop:-This is a delete or remove the element of stack is called POP.       Insert and delete   a specific number in stack by using push() and pop() #include<stdio.h> struct Node {    int data...