program to enter data presence.

program to include the name or the data intended for Presence.
the program we use link list to create links in the value of the variable.

The following example program:

#include <cstdlib>
#include <iostream>

using namespace std;
//class Presensi
class Presensi{
public:
Presensi(){} //konstruktor
Presensi(string nama, string nim); //default konstruktor
void tambahPresensi(string nama, string nim); //method tambah presensi
void cetak(); //method untuk cetak presensi
private:
//struct Mahasiswa
struct Mahasiswa{
string Nama; // variabel Nama dengan tipe data string
string Nim; // variabel Nim dengan tipe data string
}
Mhs; //objek baru dari struct Mahasiswa dengan nama Mhs

};

Presensi::Presensi(string nama,string nim){
nama = “”;
nim = “”;
this->Mhs.Nama = nama; // assignment variabel nama to Nama
this->Mhs.Nim = nim; // assignment variabel nim toNim
}

void Presensi::tambahPresensi(string nama, string nim){
this->Mhs.Nama = nama; // assignment variabel nama to Nama
this->Mhs.Nim = nim; // assignment variabel nim to Nim
}

void Presensi::cetak(){
cout<<Mhs.Nama<<” ( “<<Mhs.Nim<<” )”<<endl; // cetak presensi (Nama dan Nim)

}

int main(int argc, char *argv[])
{
Presensi x[2];
string a,b;

for(int i=0;i<2;i++){
cout<<“Masukkan Nama Anda :”;
cin>>a;
cout<<“Masukkan Nim Anda :”;
cin>>b;

x[i].tambahPresensi(a,b);
}

for(int j=0;j<2;j++){

x[j].cetak();

}

system(“pause”);
return 0;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: