Ajax
ASP
C,C++
C#,.NET
CSS,HTML
Delphi,Kylix
Experience
Flash
Java
JavaScript
PHP
Python
QT
SQL
ShellScript
VB
U :
P :
Register
Lost Password
Other Links
Code Archive
Save Giovanni
C,C++ Category Code
Real Name
:
doğa shinoda
Subject
:
ilk programım
Description
:
c'de dosya işleme
#include<stdio.h> #include<conio.h> #include<stdlib.h> int main() { struct x{ int kod; char ad[40]; int kredı; int sayı; float ort; }uye; char cev;/*CEVAP*/ FILE *fp; int i,kaysay; /*dosyayı ac ve hata kontrolu yap*/ fp=fopen("test.txt","wb+"); if(fp==NULL) { printf("\ndosya acılmıyor!"); return 1; } /*bılgı gırısı ve dosyaya bılgı aktarma*/ do{ printf("KOD:"); scanf("%d",&uye.kod); printf("dersin adi;"); scanf("%s",&uye.ad); printf("dersin kredisi:"); scanf("%d",&uye.kredı); printf("ogrenci sayisi:"); scanf("%d",&uye.sayı); printf("not ortalamasi:"); scanf("%f",&uye.ort); printf("DEVAM e/h"); fwrite(&uye,sizeof(uye),1,fp); cev=getche(); }while(cev=='e'||cev=='E'); /*kayıt sayısını hesapla*/ kaysay=ftell(fp)/sizeof(uye); /*dosya yer belırleyıcısını basa al*/ fseek(fp,0,SEEK_SET); for(i=1;i<=kaysay;i++) { fread(&uye,sizeof(uye),1,fp); printf("\n%d %s %d %d %f\n",uye.kod,uye.ad,uye.kredı,uye.sayı,uye.ort); } fclose(fp); }
Rating
:
4.25
(out of 5)
Visitor Voting Booth
:
Excellent
Very Good
Good
Fair
Poor
Copyright © 2006 SharingCode.NET . All rights reserved. Hosted By: SisNetworks