minghags 0 Junior Poster in Training

Hello!

I just made an program, but now i have problem with sorting output in the asc. order (int datum) thats date in our language :)

#include <iostream.h>
#include <stdlib.h>
struct datum
{
    char dan [32];
    char mesec [13];
    char leto [5];
    void vnosDatum();
    void izpisDatum();
};
void datum::vnosDatum()
{
    cout << "Dan: ";
    cin.ignore();
    cin.getline(dan,32);
    cout << "Mesec: ";
    cin.getline(mesec,13);
    cout << "Leto: ";
    cin.getline(leto,5);
}

void datum::izpisDatum()
{
    cout << "Datum nakupa: " <<dan << "." << mesec <<"."<< leto << "\n";
}
struct racunalnik
{
    datum datum;
    char ime[10] ;
    int hitrost_procesorja;
    int velikost_pomnilnika;
    int stevilo_jeder;
    void Vpisi();
    void Izpis();
    
};

void racunalnik::Vpisi()
{
    cout << "Znamka računalnika: ";
    cin.getline(ime,10);
    cout <<"Hitrost procesorja [v MHz]: ";
    cin >> hitrost_procesorja ;
    cout <<"Število jeder: ";
    cin >> stevilo_jeder ;
    cout <<"Velikost pomnilnika [v GB]: ";
    cin >> velikost_pomnilnika ;
    datum.vnosDatum();
}
void racunalnik::Izpis()
{
    cout << "\n" <<endl;
    cout << "Ime računalnika: "<< ime<<endl ;
    cout << "Hitrost procesorja: " << hitrost_procesorja <<" MHz "<<endl ;
    cout << "Število jeder: " << stevilo_jeder <<endl ;
    cout << "Velikost pomnilnika: " << velikost_pomnilnika <<" GB "<<endl ;
    datum.izpisDatum();
}
int main()
{
    
    racunalnik racunalnik[10];
    int i;
    for ( i = 1; i < 11 ; i++)
    {
        cout << "Vpišite podatke za računalnik " << i << endl;
        racunalnik[i].Vpisi();
    }
    for ( i = 1; i < 11 ; i++)
    {
        cout << "Spesifikacije za računalnik " << i << endl;
        racunalnik[i].Izpis();
    }
    return 0;
}

Thanks in advance.

Be a part of the DaniWeb community

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