Showing posts with label Advanced Programs. Show all posts

Write a program which takes input in Cartesian coordinates (x, y) and calculate and display the Polar coordinates.

Write a program which takes input in Cartesian coordinates (x, y) and calculate and display the Polar  coordinates.

#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    float r, thet = 0, rad, x, y;
    cout << "Enter value of x-axis: ";
    cin>>x;
    cout << "Enter value of y-axis: ";
    cin>>y;
    r = (x*x) + (y*y);
    r = sqrt(r);
    thet = atan2(x,y) * 180 / 3.1415;
    cout << endl << "Coordinates in Polar is (" << r << " , " << thet << ")" << endl;
    system("pause");
}

Write a program to check whether the given number is palindrome or not?

Note: Polindrome is a number that is same if we reverse it. e.g: 151 reverse is 151



#include <iostream>
using namespace std;

int main()
{
    int number, ans = 0, temp;
    cout << "Enter a number: ";
    cin >> number;
    temp = number;
    while( number != 0)
    {
           ans = ans*10;
           ans = ans + number%10;
           number = number/10;
    }
    if(ans == temp)
    {
           cout << "Number is polindrome.";
    }
    else
    {
           cout << "Number is not polindrome.";
    }
    system("pause");
}

Write a program in C++ to find angle between minutes and second hand, hour and second hand and hour and minute hand.

#include <iostream>
using namespace std;

int main()
{
    int hour, minut, second, angle1, angle2, angle;
    cout << "Enter hour: ";
    cin >> hour;
    cout << "Enter minut: ";
    cin >> minut;
    cout << "Enter second: ";
    cin >> second;
   
    //angle between hour and minut.
    if(angle1 == 12)
    angle1 = 0;
   
    angle1 = hour*30;
    angle2 = minut*6;
 
    angle = angle2 - angle1;
    if(angle < 0)
    {
         angle1 = 360 - angle1;
         angle = angle1 + angle2;
    }
    cout << "Angle between hour and minut is: ";
    cout << angle << endl;
   
    //angle between hour and second.
    if(angle1 == 12)
    angle1 = 0;
   
    angle1 = hour*30;
    angle2 = second*6;

    angle = angle2 - angle1;
    if(angle < 0)
    {
         angle1 = 360 - angle1;
         angle = angle1 + angle2;
    }
    cout << "Angle between hour and second is: ";
    cout << angle << endl;
   
    //angle between hour and second.
    angle1 = minut*6;
    angle2 = second*6;

    angle = angle2 - angle1;
    if(angle < 0)
    {
         angle1 = 360 - angle1;
         angle = angle1 + angle2;
    }
    cout << "Angle between hour and second is: ";
    cout << angle << endl;
   
    cout <<endl;
    system("pause");
}

Write a Program To Find The Highest Common Factor in C Language


#include<stdio.h>
#include<conio.h>
int higest_common_factor(int number1 ,int number2);
 main()
{
int number1,number2;
//; clrscr();
printf("enter the two number :");
scanf("\n%d\n%d",&number1 ,&number2);


printf("\n higest_common_factor of two numbers is =%d",higest_common_factor(number1,number2));

getch();
}


int higest_common_factor(int number1 ,int number2)
{
int counter,minimum,m;
if (number1>number2)
{
minimum=number2;
}
else
{
minimum=number1;
}

for(counter=minimum;counter>=1;counter--)
{
if(number1%counter==0 && number2%counter==0)
{
  m=counter;
return m;
  }

}
  }

Write A Program To Find The Power Of Number

#include<stdio.h>
#include<conio.h>
 main()

{
  int p,n,l=1;
 int s=1;

  printf("\nEnter number = ");
  scanf("%d",&n);

  printf("\nEnter  power =");
  scanf("%d",&p);

  while(l<=p)
  {
      s=s*n;
      l++;
  }

  printf("\n%d  raise to power %d is= %ld",n,p,s);
  getche();
}

Write A code Of Fibonacci series without Recursion.

#include<stdio.h>
#include<conio.h>


int main(void)
{
    int n,l=0,m=1,c=0,counter=1;
    printf("How many number you want to Generate: ");
    scanf("%d",&n);
    printf("%d  %d",l,m);
    while(counter<=n-2)
    {
        c=l+m;
        printf("  %d",c);
        l=m;
        m=c;
      counter++;
    }
getch();

}

Write a program in c language to concatenate two strings.

#include<conio.h>
#include<stdio.h>

void stringconcatenation(char[],char[]);

 main()
{

    char mrr1[100],mrr2[100];
    printf("Enter the first string: ");
   gets(mrr1);
    printf("Enter the second string: ");
    gets(mrr2);
    stringconcatenation(mrr1,mrr2);
   printf("The String after concatenation: %s",mrr1);
    getch();
}
void stringconcatenation(char mrr1[],char mrr2[])
{
    int l=0,k=0;
    while(mrr1[l]!='\0')
    {
         l++;
    }
  while(mrr2[k]!='\0')
    {
         mrr1[l] = mrr2[k];
         l++;
         k++;
    }
 mrr1[l] ='\0';
}

Write a c language program to convert decimal to binary using recursion.

#include <stdio.h>
#include <conio.h>
long DecToBin(int); //declaration

int main(){

    long BinNo;
    int DecNo;

    printf("Enter any decimal number: ");
    scanf("%d",&DecNo);

    BinNo = DecToBin(DecNo);
    printf("Binary value is: %ld", BinNo);

    getch();
}
//definition
long DecToBin(int DecNo)
{

    static long BinNo,remainder,factor = 1;

    if(DecNo != 0)
    {

         remainder = DecNo % 2;
         BinNo = BinNo + remainder * factor;
         factor = factor * 10;
         DecToBin(DecNo / 2);
    }

    return BinNo;
}

Mouse pointer with menu in c language.


Note: This program is compiled and executed in Turbo 3.0

#include <graphics.h>
#include <conio.h>
#include <iostream.h>
#include <dos.h>
#include <stdio.h>


//mouse pointer functions
union REGS in,out;

       int callmouse()
       {
     in.x.ax=1;
     int86(51,&in,&out);
     return 1;
       }
       void mouseposi(int &xpos,int &ypos,int &click)
       {
     in.x.ax=3;
     int86(51,&in,&out);
     click=out.x.bx;
     xpos=out.x.cx;
     ypos=out.x.dx;
}
      void setposi(int &xpos,int &ypos)
      {
    in.x.ax=4;
    in.x.cx=xpos;
    in.x.dx=ypos;
    int86(51,&in,&out);
      }
//end mouse pointer code

int set_command()
{
    int x,y,cl,a,b, change, i;
    a=100;
    b=400;
    setposi(a,b);
    callmouse();
    gotoxy(10, 12);
    //printf("%d", cl);
    do
    {
   change=cl;
   mouseposi(x,y,cl);
   gotoxy(10, 7);
   printf("x=%d  y=%d   click=%d", x, y, cl);
   gotoxy(10,9);
   if(i==26)
   {
printf("Enter New Entry.");
   }
   if(cl!=change)
   {
if((x>=10 && x<=95) && (y>=6 && y<=18))
{
      printf("Goto Setter.     ");
}
if((x>=95 && x<=190) && (y>=6 && y<=18))
{
    printf("Edit Data.       ");
}
if((x>=350 && x<=480) && (y>=6 && y<=18))
{
     printf("Goto Main.       ");
}
if((x>=495 && x<=575) && (y>=6 && y<=18))
{
     printf("Save data in file");
}
if((x>=585 && x<=630) && (y>=6 && y<=18))
{
     return 0;
}
   }
    }while(!kbhit());
}

int main(void)
{
   char command;
   clrscr();
   int gdriver = DETECT, gmode, errorcode;
   clrscr();
   initgraph(&gdriver, &gmode, "C:\\turboc3\\bgi");
   setcolor(getmaxcolor());
   settextstyle(0,0,1);
   outtextxy(10,8,"New Entry | Edit Entry                     Goto: Main Menu | Save Data | Quit");

   set_command();
}

Write A Program Of Composition in OOP

#include<iostream>
#include<string.h>
#include<conio.h>
using namespace std;
class student
{
int roll_no;
int marks;
public:
void get()
{
cout<<"Enter roll no"<<endl;
cin>>roll_no;

cout<<"Enter marks:"<<endl;
cin>>marks;
cout<<"***********\n";
    cout<<"roll is "<<roll_no;
cout<<"\nmarks is "<<marks;
}
};
class university
{
student s1;
public:
void get()
{
s1.get();

}

};

int main()
{
university l1;
l1.get();
getch();
return 0;

}

Write a program to print time on screen.

#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <string>
int main(void)
{
    time_t current_time;
    char* c_time_string, finel_time;

    current_time = time(NULL);
    c_time_string = tm(&current_time);
    (void) printf("%s", c_time_string+4);
    getch();
}

Write a program to create single link list.

#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
struct node
{
       int data;
       struct node *link;
};
struct node *n, *first, *this1;
int main()
{
    char ch;
    first=NULL;
    printf("Enter q to quit: ");
    ch=getche();
    while(ch!='q')
    {
           n=(struct node *)malloc(sizeof(struct node));
           printf("\nEnter data to store in node: ");
           scanf("%d", &n->data);
           n->link=NULL;
           if(first==NULL)
           {
                  first=n;
           }
           else
           {
                  this1=first;
                  while(this1->link!=NULL)
                  {
                          this1=this1->link;
                  }
                  this1->link=n;
           }
           printf("Press q to quit: ");
           ch=getche();
    }
    printf("\n");
    this1=first;
           while(this1!=NULL)
           {
                   printf("%d\n", this1->data);
                   this1=this1->link;
           }
    getch();
   
}

Write a program to multiply two matrix and show result on screen

#include <stdio.h>
#include <conio.h>
int main()
{
    int i, j, k, a1[5][5], a2[5][5], a3[5][5], r1, r2, c1, c2, sum;
    printf("Enter number of rows for fisrt metrix: ");
    scanf("%d", &r1);
    printf("Enter number of columns for fisrt metrix: ");
    scanf("%d", &c1);
    printf("Enter number of rows for second metrix: ");
    scanf("%d", &r2);
    printf("Enter number of columns for second metrix: ");
    scanf("%d", &c2);
    if(c1!=r2)
    {
           printf("Multiplication cannot take place, columns of first metrix should be equal to second row.");
    }
    else
    {
        // enter elements in metrix
        for(i=0; i<r1; i++)
                 {
                        for(j=0; j<c1; j++)
                        {
                                 printf("Enter element of row %d and colimn %d: ", i, j);
                                 scanf("%d",&a1[i][j]);
                        }
                 }
        for(i=0; i<r2; i++)
                 {
                        for(j=0; j<c2; j++)
                        {
                                 printf("Enter element of row %d and colimn %d: ", i, j);
                                 scanf("%d", &a2[i][j]);
                        }
                 }
                
        for(i=0; i<r1; i++)
        {
                 for(j=0; j<c2; j++)
                 {
                          sum=0;
                          for(k=0; k<c1; k++)
                          {
                                   sum=sum+a1[i][k]*a2[k][j];
                                   a3[i][j]=sum;
                          }
                 }
        }
             //show elements of metrix.
        printf("\n");
        for(i=0; i<r1; i++)
                 {
                        for(j=0; j<c1; j++)
                        {
                                 printf("%d\t", a1[i][j]);
                        }
                        printf("\n");
                 }
        printf("\n");
        for(i=0; i<r2; i++)
                 {
                        for(j=0; j<c2; j++)
                        {
                                 printf("%d\t", a2[i][j]);
                        }
                        printf("\n");
                 }
        printf("Multiplication of array: \n");
        for(i=0; i<r2; i++)
                 {
                        for(j=0; j<c2; j++)
                        {
                                 printf("%d\t", a3[i][j]);
                        }
                        printf("\n");
                 }
    }
    getch();
}

Write a C program to implement the following: 1. Take an int array of 100 elements. Populate it using random number generator built-in function. 2. User will be given the following choices: a) To insert a new element in the array. b) To delete an element in the array. c) To search an item in the array. d) To update an item in the array. e) To show the elements of the array. f) To quit from the program.

#include <stdio.h>
#include <conio.h>
#include <iostream.h>
int main()
{
    int i, a[100], loc, item, size=99;
    char option;
    for(i=0; i<=size; i++)
    {
             a[i]= rand() % 20;
    }
    printf("Press a, b, c, d, e, f\na)  To insert a new element in the array. \nb)  To delete an element in the array.  \nc)  To search an item in the array. \nd)  To update an item in the array. \ne)  To show the elements of the array. \nf)  To quit from the program.");
    option=getche();
    while(option!='f')
    {
    switch(option)
    {
           case 'a':
                if(size==100)
                {
                             printf("you can never add more elements because array in completlty filled.");
                }
                else
                {
                    printf("\nEnter location where you want to enter number: ");
                    scanf("%d", &loc);
                    printf("\nEnter number: ");
                    scanf("%d", &item);
                    for(i=size+1; i>loc; i--)
                                {
                                         a[i]=a[i-1];
                                }
                   a[loc]=item;
                   size++;
                   break;
                }
    case 'b':
         printf("\nEnter location where you want to delete number: ");
    scanf("%d", &loc);
    for(i=loc; i<=size; i++)
    {
             a[i]=a[i+1];
    }
    size--;
    break;
    case 'c':
         printf("\nEnter number which you want to search from array: ");
    scanf("%d", &item);
    for(i=0; i<=size; i++)
    {
             if(item==a[i])
             {
                         loc=i;
                         break;
             }
    }
    if(i>size)
    {
           printf("\nNumber is not found in array.");
    }
    else
    {
        printf("\n%d is found at location %d", item, loc);
    }
    break;
    case 'd':
         printf("\nEnter location where you want to update number: ");
    scanf("%d", &loc);
    printf("Enter number: ");
    scanf("%d", &item);
    a[loc]=item;
    for(i=0; i<=size; i++)
    {
             printf("%d ", a[i]);
    }
    break;
    case 'e':
    printf("\n");
    for(i=0; i<=size; i++)
    {
             printf("%d ", a[i]);
    }
    break;
         default:
         printf("\nYou have entered invalid entry.");
}
printf("\nPress a, b, c, d, e, f\na)  To insert a new element in the array. \nb)  To delete an element in the array.  \nc)  To search an item in the array. \nd)  To update an item in the array. \ne)  To show the elements of the array. \nf)  To quit from the program.");
option=getche();
}
}

Write A Program Search A Given Number In Array Using Linear Search

#include <stdio.h>
#include <conio.h>
int main()
{
   int array[100], s, d, number;

   printf("Enter the number of elements in array: ");
   scanf("%d",&number);

   printf("Enter %d numbers: ", number);

   for ( d = 0 ; d < number ; d++ )
      scanf("%d",&array[d]);

   printf("Enter the number to search: ");
   scanf("%d",&s);

   for ( d = 0 ; d < number ; d++ )
   {
      if ( array[d] == s )  
      {
         printf("%d is present at location %d.", s, d+1);
break;
      }
   }
   if ( d == number )
      printf("%d is not present in array.", s);  

   getch();
}

Write A Program To Delete A Number From Array


#include <stdio.h>
#include <conio.h>
int main()
{
   int array[100], p, d, n;

   printf("Enter number of elements in array\n");
   scanf("%d", &n);

   printf("Enter elements");
   printf("%d\n",n);

   for ( d = 0 ; d < n ; d++ )
      scanf("%d", &array[d]);

   printf("Enter the location where you wish to delete element\n");
   scanf("%d", &p);

   if ( p >= n+1 )
      printf("Deletion not possible.\n");
   else
 
   {
      for ( d = p - 1 ; d < n - 1 ; d++ )
         array[d] = array[d+1];

      printf("Result array is\n");

      for( d = 0 ; d < n - 1 ; d++ )
         printf("%d\n", array[d]);
   }

 getch();
}

Write a program in C language for bubble sorting in ascending order.

#include <stdio.h>
#include <conio.h>
int main()
{
  int s,temp,i,j,array[20];

  printf("Enter total numbers of elements: ");
  scanf("%d",&s);

  printf("Enter %d elements: ",s);
  for(i=0;i<s;i++)
  {
      scanf("%d",&array[i]);
  }
     
  for(i=s-2;i>=0;i--)
  {
      for(j=0;j<=i;j++)
      {
           if(array[j]>array[j+1])
           {
              temp=array[j];
              array[j]=array[j+1];
              array[j+1]=temp;
           }
      }
  }

  printf("After sorting: ");
 
  for(i=0;i<s;i++)
  {
      printf(" %d",array[i]);
  }

  getch();
}

Code of Game in C++


Click Here To Download Compiled Game

Write a program to get first n prime numbers

#include <stdio.h>

#include <conio.h>
int main()
{
       int a, b, counter=0, limit=0, num;
       printf("Enter number: ");
       scanf("%d", &num);
       for(a=1; a<=100000; a++)
       {
                counter=0;
                for(b=2; b<a; b++)
                {
                         if ((a%b)==0)
                         {
                            counter++;
                         }  
                }
                if(counter==0)
                {
                              printf("%d \n", a);
                              limit++;          
                }
             if(limit==num)
             {
                       break;      
             }    
       }
       getch();
}

Write a program to write a today date and print a tomorrow date


#include <stdio.h>
#include <conio.h>
struct date
{
       int day;
       int month;
       int year;
 
} today, tomorrow;

int main()
{
    char again;
    again:
     struct date;
     printf("Enter today's date: ");
     scanf("%d", &today.day);
     printf("Enter month: ");
     scanf("%d", &today.month);
     printf("Enter year:  ");
     scanf("%d", &today.year);

     switch(today.month)
     {
              case 1:
                   if(today.day==31)
                                    {
                                             tomorrow.month=today.month+1;
                                             tomorrow.day=1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/%d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                   else if(today.day<31 && today.day>=1)
                                    {
                                             tomorrow.month=today.month;
                                             tomorrow.day=today.day+1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/%d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                   else
                   printf("Enter a valid date, month and year");              
              break;
              case 2:
                                      if(today.day==28)
                                    {
                                             tomorrow.month=today.month+1;
                                             tomorrow.day=1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                   else if(today.day<28 && today.day>=1)
                                    {
                                             tomorrow.month=today.month;
                                             tomorrow.day=today.day+1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                else
                   printf("Enter a valid date, month and year");
              break;
              case 3:
                                      if(today.day==31)
                                    {
                                             tomorrow.month=today.month+1;
                                             tomorrow.day=1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                   else if(today.day<31 && today.day>=1)
                                    {
                                             tomorrow.month=today.month;
                                             tomorrow.day=today.day+1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                   else
                   printf("Enter a valid date, month and year");
              break;
              case 4:
                                      if(today.day==30)
                                    {
                                             tomorrow.month=today.month+1;
                                             tomorrow.day=1;
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                   else if(today.day<30 && today.day>=1)
                                    {
                                             tomorrow.month=today.month;
                                             tomorrow.day=today.day+1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                     else
                   printf("Enter a valid date, month and year");
              break;
              case 5:
                                      if(today.day==31)
                                    {
                                             tomorrow.month=today.month+1;
                                             tomorrow.day=1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                   else if(today.day<31 && today.day>=1)
                                    {
                                             tomorrow.month=today.month;
                                             tomorrow.day=today.day+1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                               
                                      else
                   printf("Enter a valid date, month and year");
              break;
              case 6:
                                      if(today.day==30)
                                    {
                                             tomorrow.month=today.month+1;
                                             tomorrow.day=1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                   else if(today.day<30 && today.day>=1)
                                    {
                                             tomorrow.month=today.month;
                                             tomorrow.day=today.day+1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                                      else
                   printf("Enter a valid date, month and year");
              break;
              case 7:
                                      if(today.day==31)
                                    {
                                             tomorrow.month=today.month+1;
                                             tomorrow.day=1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                   else if(today.day<31 && today.day>=1)
                                    {
                                             tomorrow.month=today.month;
                                             tomorrow.day=today.day+1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                                      else
                   printf("Enter a valid date, month and year");
              break;
              case 8:
                                      if(today.day==31)
                                    {
                                             tomorrow.month=today.month+1;
                                             tomorrow.day=1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                   else if(today.day<31 && today.day>=1)
                                    {
                                             tomorrow.month=today.month;
                                             tomorrow.day=today.day+1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                                      else
                   printf("Enter a valid date, month and year");
              break;
              case 9:
                                      if(today.day==30)
                                    {
                                             tomorrow.month=today.month+1;
                                             tomorrow.day=1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                   else if(today.day<30 && today.day>=1)
                                    {
                                             tomorrow.month=today.month;
                                             tomorrow.day=today.day+1;
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                                      else
                   printf("Enter a valid date, month and year");
              break;
              case 10:
                                      if(today.day==31)
                                    {
                                             tomorrow.month=today.month+1;
                                             tomorrow.day=1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                  else if(today.day<31 && today.day>=1)
                                    {
                                             tomorrow.month=today.month;
                                             tomorrow.day=today.day+1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                                      else
                   printf("Enter a valid date, month and year");
              break;
              case 11:
                                      if(today.day==30)
                                    {
                                             tomorrow.month=today.month+1;
                                             tomorrow.day=1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                    else if(today.day<30 && today.day>=1)
                                    {
                                             tomorrow.month=today.month;
                                             tomorrow.day=today.day+1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                                      else
                   printf("Enter a valid date, month and year");
              break;
              case 12:
                                      if(today.day==31)
                                    {
                                             tomorrow.month=1;
                                             tomorrow.day=1;
                                             tomorrow.year=today.year+1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, tomorrow.year);    
                                    }
                   else if(today.day<31 && today.day>=1)
                                    {
                                             tomorrow.month=today.month;
                                             tomorrow.day=today.day+1;
                                             printf("Todays date is: %02d/%02d/%4d\n", today.day, today.month, today.year);
                                             printf("Tomorrow date will be: %02d/%02d/d", tomorrow.day, tomorrow.month, today.year);    
                                    }
                                      else
                   printf("Enter a valid date, month and year");
              break;
         
              default:
                      printf("Enter a valid date, month and year");              
                   
     }
     printf("\nWould you like to input again? y/n ");
     again=getche();
     printf("\n");
     if(again=='y' || again=='Y')
     {
                   goto again;        
     }

     getch();
}