can you help me add a write and read function to the program below

#include <iostream>
#include <conio.h>
#include <windows.h>
#include <stdio.h>
#include <fstream>
using namespace std;

struct daerah
{
       char kel[50];
       char kec[50];
       char kota[50];
};

struct data
{
       int nomor;
       char nama[50];
       char tinggi[20];
       char status[20];
       char pekerjaan[20];
       char tempat[20];
       char tanggal[20];
       char almt[20];
       char jenis[50];
       daerah alamat;
};

main()
{

    int menu;
    int no_sim=-1,i,j;
    int pilih;
    int namedit;
    data sim[20];
    char get[1];
    bool ketemu;

    menuutama:
    system("cls");
    cout<<" ---------------- Aplikasi Data Pelanggaran Lalu Lintas ---------------";
    cout <<" \nMENU UTAMA :\n\n";
    cout<<" 1.Menambah Data Pelanggaran\n\n";
    cout<<" 2.Mencari Data Pelanggaran\n\n";
    cout<<" 3.Menghapus Data Pelanggaran\n\n";
    cout<<" 4.Menampilkan Data Pelanggaran\n\n";
    cout<<" 5.Keluar\n\n";
    cout<<" _____________________________\n\n";
    cout<<" Masukan Pilihan Anda : "; cin>>menu;

    if(menu==1)
 {
  system("cls");
     no_sim++;
     cout<<"\n PENAMBAHAN DATABASE PELANGGARAN\n";
     cout<<" ____________________________\n\n";
     cout<<" NO Surat Izin Mengemudi(SIM): "; cin>>sim[no_sim].nomor; cin.getline(get,1);
     cout<< endl;
     cout<<" Nama Lengkap                : "; cin.getline(sim[no_sim].nama,50);
     cout<< endl;
     cout<<" Tinggi badan (CM)           : "; cin.getline(sim[no_sim].tinggi,20);
     cout<< endl;
     cout<<" Status Perkawinan           : "; cin.getline(sim[no_sim].status,20);
     cout<< endl;
     cout<<" Pekerjaan                   : "; cin.getline(sim[no_sim].pekerjaan,20);
     cout<< endl;
     cout<<" Tempat Lahir                : "; cin.getline(sim[no_sim].tempat,20);
     cout<< endl;
     cout<<" Tanggal Lahir (DD MM YYYY)  : "; cin.getline(sim[no_sim].tanggal,20);
     cout<< endl;
     cout<<" Alamat                      : "; cin.getline(sim[no_sim].almt,20);
     cout<< endl;
     cout<<" Kelurahan                   : "; cin.getline(sim[no_sim].alamat.kel,20);
     cout<< endl;
     cout<<" Kecamatan                   : "; cin.getline(sim[no_sim].alamat.kec,20);
     cout<< endl;
     cout<<" Kota                        : "; cin.getline(sim[no_sim].alamat.kota,20);
     cout<< endl;
     cout<<" Pelanggaran Lalu Lintas     : "; cin.getline(sim[no_sim].jenis,50);
     cout<<" _________________________________________________________________\n\n";
     cout<<" 1.Kembali ke Menu Utama\n\n";
     cout<<" 2.Keluar dari program\n";
     cout<<" _____________________________\n\n";
     cout<<" Masukan Pilihan Anda : "; cin>>pilih;
     cout<<endl;
     if(pilih==1)
  {
      goto menuutama;
     }
     else if(pilih==2)
  {
      goto keluar;
     }
    }

    else if(menu==2)
 {
  system ("cls");
     cout<<"\n PENCARIAN DATA PELANGGARAN\n";
     cout<<" ____________________________\n\n";
     cout<<" Masukan NO SIM : "; cin>>namedit;
     cout<<endl;

     for(i=0;i<=no_sim;i++)
  {
      if(namedit==sim[i].nomor)
   {
       cout<<" Data di temukan pada DATA PELANGGARAN"<<i<<endl<<endl;
       cout<<" Nama Lengkap      : "<<sim[i].nama<<endl;
       cout<<endl;
       cout<<" Tinggi Badan (CM) : "<<sim[i].tinggi<<endl;
       cout<<endl;
       cout<<" Status perkawinan : "<<sim[i].status<<endl;
       cout<<endl;
       cout<<" Pekerjaan         : "<<sim[i].pekerjaan<<endl;
       cout<<endl;
       cout<<" Tempat Lahir      : "<<sim[i].tempat<<endl;
       cout<<endl;
       cout<<" Tanggal Lahir     : "<<sim[i].tanggal<<endl;
       cout<<endl;
       cout<<" Alamat            : "<<sim[i].almt<<endl;
       cout<<endl;
       cout<<" Kelurahan         : "<<sim[i].alamat.kel<<endl;
       cout<<endl;
       cout<<" Kecamatan         : "<<sim[i].alamat.kec<<endl;
       cout<<endl;
       cout<<" Kota              : "<<sim[i].alamat.kota<<endl<<endl;
       cout<<endl;
       cout<<" PELANGGARAN       : "<<sim[i].jenis<<endl;
       cout<<" _____________________________________________________\n\n";

                goto menu0;
      }
     }
     cout<<" DATA YANG ANDA CARI TIDAK DI TEMUKAN !!!\n\n";
     cout<<" ________________________________________\n\n";
        menu0:
     cout<<" 1.Kembali ke Menu Utama\n\n";
     cout<<" 2.Keluar dari program\n";
     cout<<" _____________________________\n\n";
        cout<<" Masukan Pilihan Anda : "; cin>>pilih;

        if(pilih==1)
  {
      goto menuutama;
     }
     else if(pilih==2)
  {
      goto keluar;
     }
 }

 else if(menu==3)
 {
  system ("cls");
  cout<<"\n PENGHAPUSAN DATA PELANGGARAN\n";
  cout<<" ____________________________________\n\n";
  cout<<" NO SIM : "; cin>>namedit;
     cout<<endl;

        for(i=0;i<=no_sim;i++)
  {
      if(namedit==sim[i].nomor)
   {
    ketemu=true;
    if(ketemu)
    {
     for(j=i;j<=no_sim+1;j++)
     {
      sim[j]=sim[j+1];
     }
     cout<<" DATA BERHASIL DI HAPUS\n\n";
     no_sim--;
     goto menu;
    }
   }
  }
  cout<<" DATA YANG AKAN DI HAPUS TIDAK DITEMUKAN !!!\n";
  cout<<" ____________________________________________\n\n";
        menu:
     cout<<" 1.Kembali ke Menu Utama\n\n";
     cout<<" 2.Keluar dari program\n";
     cout<<" _____________________________\n\n";
        cout<<" Masukan Pilihan Anda : "; cin>>pilih;
        if(pilih==1)
  {
      goto menuutama;
     }
     else if(pilih==2)
        {
      goto keluar;
     }
 }

 else if(menu==4)
 {
  system ("PELANGGARAN");
  cout<<"\n MENAMPILKAN DATA PELANGGARAN (PELANGGARAN)\n";
  cout<<" _________________________________\n\n";
        for(i=0;i<=no_sim;i++)
  {
     cout<<" Database PELANGGARAN ke-"<<i<<endl<<endl;
     cout<<" NO SIM            : "<<sim[i].nomor<<endl<<endl;
     cout<<" Nama              : "<<sim[i].nama<<endl<<endl;
     cout<<" Tinggi Badan (CM) : "<<sim[i].tinggi<<endl<<"CM"<<endl;
     cout<<" Status perkawinan : "<<sim[i].status<<endl<<endl;
     cout<<" Pekerjaan         : "<<sim[i].pekerjaan<<endl<<endl;
     cout<<" Tempat Lahir      : "<<sim[i].tempat<<endl<<endl;
     cout<<" Tanggal Lahir     : "<<sim[i].tanggal<<endl<<endl;
     cout<<" Alamat            : "<<sim[i].almt<<endl<<endl;
     cout<<" Kelurahan         : "<<sim[i].alamat.kel<<endl<<endl;
     cout<<" Kecamatan         : "<<sim[i].alamat.kec<<endl<<endl;
     cout<<" Kota              : "<<sim[i].alamat.kota<<endl<<endl;
     cout<<" PELANGGARAN       : "<<sim[i].jenis<<endl<<endl;
  }
     cout<<" _____________________________________________\n\n";
     cout<<" 1.Kembali ke menu awal\n\n";
     cout<<" 2.keluar dari program\n";
     cout<<" _____________________________\n\n";
     cout<<" Masukan Pilihan Anda : "; cin>>pilih;
        if(pilih==1)
  {
      goto menuutama;
     }
     else if(pilih==2)
  {
      goto keluar;
     }

 keluar:
    system("PELANGGARAN");
    cout<<"\n TERIMA KASIH\n";
    getch();
    return 0;
    }
}

First off, your code is already reading(cin) and writing(cout).

Also you're getting into bad habits using goto. I have yet to see any code where using the goto structure is absolutely necessary. I would suggest following some tutorials on OOP(Object Oriented Programming).

Once you get your code cleaned up to the point where someone else will be able to understand your code, then you can look at adding functionality to it.

Since this is an English speaking site. I would suggest translating your menus. It's very difficult to try and figure them out.

commented: can you change it please i want to learn +0
Be a part of the DaniWeb community

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