Bài tập lập trình PHẦN IV tệp

6 144 0
Bài tập lập trình PHẦN IV  tệp

Đang tải... (xem toàn văn)

Thông tin tài liệu

Phần IV : Tệp Câu 1: #include #include void main() {clrscr(); int i,n; float a[100]; FILE *f; printf("ban muon nhap bao nhieu so thuc? "); scanf("%d",&n); f=fopen("stduong.txt","wt"); for (i=0;i0) fprintf(f,"%5.1f",a[i]); } fclose(f); getch(); } Câu 2: #include #include void doc_tep(FILE *f,int a[],int *n) {int i=0; while (feof(f)==0) {fscanf(f,"%d",&a[i]); i++; } fclose(f); *n=i; } int tong(int a[], int n) {int i=0,s=0; while (i

Ngày đăng: 25/03/2018, 21:24

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan