here is my code:

#include <fstream>
#include <iostream>
#include <string>
#include <fstream>
#include <string>

using namespace std;

void displayjulianDates(int, int, int, int, int, int);

int main()
{
    //Declare variables
    int month1;
    int day1;
    int year1;
    int month2;
    int day2;
    int year2;
   
    //Gets input from user
    cout << "Please enter the first month in the following format: MM " << endl;
    cin >> month1;
    cout << "Please enter the first day as follows: DD " << endl;
    cin >> day1;
    cout << "Please enter the first year as follows: YYYY " << endl;
    cin >> year1;
    cout << endl;
    cout << "Please enter the second month as follows: MM " << endl;
    cin >> month2;
    cout << "Please enter the second day as follows: DD " << endl;
    cin >> day2;
    cout << "Please enter the second year as follows: YYYY " << endl;
    cin >> year2;
   
    //Function Call
    displayjulianDates (month1, day1, year1, month2, day2, year2);
   
    cin.get();
}//Ends main

//Function that calculates and displays julian dates and difference
void displayjulianDates(int month1, int day1, int year1, int month2, int day2, int year2)
{
        long intRes1;
        long intRes2;
        long intRes3;
        long intRes4;
        long intRes5;
        long intRes6;
        long jdn1;
        long jdn2;
        long julianDifference;
       

   
        //Calculates first julian date
        intRes1 = ((2 - year1 / 100) + (year1 / 400));
        intRes2 = int(365.25 * year1);
        intRes3 = int(30.6001 * (month1 + 1));
        jdn1 = (intRes1 + intRes2 + intRes3 + day1 + 1720994.5);

        //Displays first julian date
        cout << "The first Julian Date is " << jdn1 << endl;

        //Calculates second julian date
        intRes4 = ((2 - year2 / 100) + (year2 / 400));
        intRes5 = int(365.25 * year2);
        intRes6 = int(30.6001 * (month2 + 1));
        jdn2 = (intRes4 + intRes5 + intRes6 + day2 + 1720994.5);

        //Displays second julian date
        cout << "The second Julian Date is " << jdn2 << endl;

        //Calculates julian date difference
        julianDifference = jdn2 - jdn1;

        //Displays julian difference
        cout << "The difference between the julian dates is " << julianDifference << endl;

        cin.get();
}//Ends Function

It works fine i have a little problem related to date format code i.e:
I want to allow user to Enter 8 character mamimum and date format should be like this dd/mm/yyyy. 8 characters maximum and 3rd and 6 character is " / "

Any help.
the

Some notes to OP code:
Next time (rather always) try to separate interface and calculation (processing) modules (functions). For example, it's a very useful function: long getJulianDay(int y,int m, int d) . You (and others) can use it in console or GUI programs. You can use it in the displayjulianDates function to get more compact and reliable code. However you can't reuse this cumbersome and strictly console-oriented displayjulianDates in other programs at all.

//here is another way to do it.
[B]char[/B] stroke;
[B]int[/B] day,month,year;
cout << "Enter date: (format) : dd/mm/yy";
cin >> day >> stroke >> month >> stroke >> year;
//the char stroke will take care of the strokes entered by the user
This article has been dead for over six months. Start a new discussion instead.