Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
JagoVB JagoVB is offline
Ceriwiser
 
Join Date: Nov 2011
Posts: 508
Rep Power: 15
JagoVB mempunyai hidup yang Normal
Default File

gan, mau tnya nih program ane ttg file, tiap di run, tuh bisa, ga eror, cuma 1, pengisian data nya itu loh, yg aneh



di bagian yg ane bold, itu kdg ga bsa

format notepad nya

K0001#10000#Sandal Gunung




Code:

/* Nama : Ibnu Vito Gunadi
Kelas : TI-C
NIM : 10110110099
*/

#include
#include
#include
#include

struct brg{
char kdbrg[6],nmbrg[25];
int harga;
};

struct jual{
int nota,qty,total;
char kdbrg[5];
};

void datbrg(struct brg datbar[]){
printf("1");
}

void inju(struct jual datju[]){
printf("2");
}

int main()
{
struct brg datbar[99];
struct jual datju[99];
char pilih;
int i=1;
FILE *brg,*jual;

brg = fopen("brg.txt","a+");
//jual = fopen("jual.txt","a+");

/*while(!feof(brg))
{
fscanf(brg,"%[^#]#%d#%s\n",datbar[i].kdbrg,datbar[i].harga,datbar[i].nmbrg);
i++;
}*/

while(!feof(brg))
{
fscanf(brg,"%[^#]#%[^#]#%[^\n]",&datbar[i].kdbrg,&datbar[i].harga,&datbar[i].nmbrg);
i++;
}

printf("%s\n",datbar[2].harga);


//printf("2");
printf("Pilih : \n1. Input Barang\n2. Input Penjualan\n3. List Barang\n4. List Penjualan\nx.Selesai\n");
scanf("%c",&pilih);
for( ; pilih != 'x' ; )
{switch(pilih)
{
case '1' : datbrg(datbar);

break;
case '2' : inju(datju);break;
case '3' : printf("3\n");break;
case '4' : printf("4\n");break;
}
fflush(stdin);
getche();
system("cls");
printf("Pilih : \n1. Input Barang\n2. Input Penjualan\n3. List Barang\n4. List Penjualan\nx.Selesai\n");
scanf("%c",&pilih);
}

fclose(brg);

getche();
return 0;

}



</div>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Terkait
Thread Thread Starter Forum Replies Last Post
[ASK-HELP] Join File pake HJSplit tapi ga Tahu File mana yang no.1 LinuxManiax Shareware & Freeware 0 24th October 2012 12:59 PM
JUAL File ISO Game PS1 Untuk Main di Komputer[Emulator] Only Rp.1500/File JohnnyBig Permainan & Games 0 1st October 2012 01:15 AM
JUAL Jasa Pembuatan file 3D grayscale image untuk generate file G-code CNC Sotodaging Art Design 0 14th March 2012 12:32 PM
FFSJ: The Fastest File Splitter and Joiner Version 3.3 (Buat Gabungin File) Braincode Shareware & Freeware 0 11th November 2011 02:41 PM

 


All times are GMT +7. The time now is 03:06 PM.