Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip> // std::put_time()
- #include <chrono> // std::chrono::system_clock
- #include <ctime> // std::time_t, struct std::tm, std::localtime
- using std::string;
- using std::cout;
- using std::cin;
- using std::chrono::system_clock;
- void makeLine( int len )
- {
- for ( int i = 0; i < len; i++ )
- cout << "=";
- cout << "\n";
- }
- int main()
- {
- string fullName;
- string dateOfBirth;
- string address;
- string gender;
- string email;
- string phoneNumber;
- string NIM;
- string buffer;
- std::time_t time = system_clock::to_time_t(system_clock::now());
- struct std::tm* ptm = std::localtime(&time);
- makeLine(45);
- cout << "\tFormulir Data Diri Mahasiswa\t\n";
- cout << "\tTanggal: " << std::put_time(ptm, "%c") << "\n";
- makeLine(45);
- cout << "Input data anda dibawah ini\n\n";
- cout << "Email\t\t: "; getline(cin, email);
- cout << "Nama\t\t: "; getline(cin, fullName);
- cout << "NIM\t\t: "; getline(cin, NIM);
- cout << "Jenis Kelamin\t: "; getline(cin, gender);
- cout << "Tgl. Lahir\t: "; getline(cin, dateOfBirth);
- cout << "Alamat\t\t: "; getline(cin, address);
- cout << "No. Tlp\t\t: "; getline(cin, phoneNumber);
- makeLine(45);
- cout << "\t Hasil Input Formulir\n\n";
- cout << "Email\t\t: " << email << "\n";
- cout << "Nama\t\t: " << fullName << "\n";
- cout << "NIM\t\t: " << NIM << "\n";
- cout << "Jenis Kelamin\t: " << gender << "\n";
- cout << "Tgl. Lahir\t: " << dateOfBirth << "\n";
- cout << "Alamat\t\t: " << address << "\n";
- cout << "No. Tlp\t\t: " << phoneNumber << "\n\n";
- cout << "Program berakhir.....\nTerima kasih telah menggunakan program ini :D\n\n";
- system("PAUSE");
- return 0;
- }
- // References:
- // https://www.cplusplus.com/reference/iomanip/put_time/
Advertisement
Add Comment
Please, Sign In to add comment