SHOW:
|
|
- or go back to the newest paste.
1 | //IMAGE 1 : http://prntscr.com/59ag30 | |
2 | //IMAGE 2 : http://prntscr.com/59agjj | |
3 | ||
4 | - | // menginput data dengan Borland C++ 5.02 |
4 | + | //coding nya : |
5 | ||
6 | #include <iostream> | |
7 | #include <fstream> | |
8 | #include <string> | |
9 | #include <cstdlib> | |
10 | //#include <stdio> | |
11 | //#include <windows> | |
12 | #include <conio.h> | |
13 | using namespace std; | |
14 | ||
15 | void TambahData() | |
16 | { | |
17 | string baca; | |
18 | string inputData; | |
19 | int confi; | |
20 | ||
21 | system("cls"); | |
22 | string nama, alamat, nope; | |
23 | cout <<"BETA VERSION\n"<<endl; | |
24 | cout << "Masukkan Nama : "; | |
25 | getline(cin,nama); | |
26 | cout << "Masukkan Alamat : "; | |
27 | getline(cin,alamat); | |
28 | cout << "Masukkan Nomor HP : "; | |
29 | getline(cin,nope); | |
30 | inputData ="Nama Calon Anggota\t: "+nama+"\n" "Alamat Calon Anggota\t: "+alamat+"\n" "No.HP Calon Anggota\t: "+nope+"\n\n"; | |
31 | ||
32 | ofstream baru; | |
33 | baru.open("data.txt",ios::app); //membuka file data.txt | |
34 | baru << inputData; //menambah dan menyimpan data ke file data.txt | |
35 | baru.close(); //menutup file data.txt | |
36 | cout << "\nData telah ditambah!!!"<<endl; | |
37 | cout << "Apakah anda akan menginput kembali?? (1 = ya || 2 = tidak) "; | |
38 | cin>>confi; | |
39 | ||
40 | if(confi==1){ | |
41 | TambahData(); | |
42 | } | |
43 | ||
44 | if(confi==2){ | |
45 | getch; | |
46 | } | |
47 | } | |
48 | int main() | |
49 | { | |
50 | TambahData(); //memanggil void TambahData | |
51 | return EXIT_SUCCESS; | |
52 | } |