Program to access Element in Array

 #include <iostream>

#define m 100

using namespace std;


int main()

{

    int arr[m][m],r,c,i,j;

    cout<<"Enter Your Number of Row and Column: ";

    cin>>r>>c;

    for(i=0;i<r;i++){

          for(j=0;j<c;j++){

                cout<<"Enter "<<i<<" Row "<<j<<" Column :";

                cin>>arr[i][j];

          }

    }

    for(i=0;i<r;i++){

    for(j=0;j<c;j++){

          cout<<arr[i][j]<<" ";

      }

    cout<<endl;

    }

    cout<<"Enter Your Row and Column and you want to access: ";

    cin>>r>>c;

    cout<<"Your Element is "<<arr[r][c];

    return 0;

}


Check Palindrome Using c++

 #include <iostream>


using namespace std;


int main()

{

    int n,num=0,r;

    cin>>n;

    int a = n;

    while(n>0){

         r = n%10;

         num = num*10 + r;

         n/=10;

    }

//     cout<<num;

    if(num==a)

    cout<<"Palindrome";

    else

    cout<<"Not Palindrome";

    cout<<endl;


    return 0;

}


Circular Queue Implementations Using Array

 #include <stdio.h>

#include <stdlib.h>

struct queue{

      int front,rear;

      int capacity;

      int size;

      int *array;

};

struct queue *create(int capacity){

      struct queue *q = malloc(sizeof(struct queue));

      if(!q){

            printf("Not enough Space\n");

            return NULL;

      }

      else{

            q->capacity = capacity;

            q->front = q->rear = -1;

            q->size = 0;

            q->array = malloc(sizeof(int)*q->capacity);

            if(!q){

                  printf("Not enough Space!!\n");

                  return NULL;

            }

            return q;

      }

}

int size(struct queue *q){

      return q->size;

}

int frontelement(struct queue *q){

      return q->array[q->front];

}

int rearelement(struct queue *q){

      return q->array[q->rear];

}

int fullqueue(struct queue *q){

      return q->size==q->capacity;

}

int emptyqueue(struct queue *q){

      return q->size==0;

}

void enqueue(struct queue *q,int data){

      if(fullqueue(q)){

            printf("Queue Overflow\n");

            return;

      }

      q->rear = (q->rear+1)%(q->capacity);

      q->array[q->rear] = data;

      if(q->front==-1){

            q->front=q->rear;

            q->size+=1;

      }

}

int dequeue(struct queue *q){

      if(emptyqueue(q)){

            printf("Queue is empty\n");

            return -1;

      }

      int data;

      data = q->array[q->front];

      if(q->front == q->rear){

            q->front = q->rear = -1;

            q->size = 0;

      }else{

            q->front = (q->front+1)%(q->capacity);

            q->size-=1;

      }

      return data;

}

void delete(struct queue *q){

      if(q){

            if(q->array)

            free(q->array);

            free(q);

      }

}


int main()

{

      int capacity = 5,i;

      struct queue *qu = create(capacity);

      for(i=0;i<capacity;i++){

            enqueue(qu,i);

      }

      printf("FrontElement is %d \n",frontelement(qu));

      printf("rearElement is %d \n",rearelement(qu));

    return 0;

}


Operator Overloading in C++

#include<iostream> using namespace std; class Complex { private: int real, imag; public: Complex(int r = 0, int i = 0){       re...