#include<bits/stdc++.h>
using namespace std;
struct date

int day;
int month;
int year;

int main()

struct date input[5];
for(int i=0; i<5; i++)

    cin>>input[i].day;
    cin>>input[i].month;
    cin>>input[i].year;


for (int i=0; i<4; i++)

    for (int j=i+1; j<5; j++)

        if (input[i].year > input[j].year)

            struct date temp = input[i];
            input[i] = input[j];
            input[j] = temp;

        else if (input[i].year == input[j].year && input[i].month > input[j].month)

            struct date temp = input[i];
            input[i] = input[j];
            input[j] = temp;

        else if (input[i].year == input[j].year && input[i].month == input[j].month && input[i].day > input[j].day)

            struct date temp = input[i];
            input[i] = input[j];
            input[j] = temp;






for(int i=0; i<5; i++)

    cout<<input[i].day<<" "<<input[i].month<<" "<<input[i].year;
    cout<<endl;

I suggest you write it from scratch rather than convert. It's your code so you know what it does and you know C so you write a new app knowing what you know.

In parting the formatting of your code looks to have failed. Take time to make good looking posts by checking what it looks like with the Preview feature.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.