Tag: C

  • Bài giảng môn Tin học Đại cương

    [attach]1[/attach][attach]2[/attach][attach]3[/attach]

  • Bài tập thực hành số 3 môn Lập trình C++ – Đọc số 2-3 chữ số và ngày tháng năm

    Đây là bài thực hành số 3. Ai muốn tham khảo thì download về theo địa chỉ dưới đây nhe.http://www.mediafire.com/?865r59jv9n82ea9Dùng chương trình C-Free Standard 4.0 cho nhẹ nhe. Tải ở http://www.programarts.com/download/cfree4_0_std_setup.exe Đọc số có 2 chữ số:[codes=c] #include<stdio.h> #include<conio.h> void main () {      int n,ch,dv;      tt:      printf("nhap so n: ");      scanf("%i",&n);      if(n>99||n<10)      {  printf("ban nhap sai roi. nhap lai so co hai…

  • Chương trình c Ước của một số

    viết chương trình nhập vào số tự nhiên và nó in ra ước của nó.Hòi sáng cô dạy ngồi áp dụng tại chỗ và post lun, các bạn edit lại nhé 🙂[codes=c]#include<stdio.h>#include<conio.h>void main(){  int n,i;  printf("nhap n: " ) ;    scanf("%d",&n) ;  i=1 ;  printf("uoc la: " ) ;    printf(" 1 " ) ;  while ( n>=i)  {    i = i+1 ;    if (n%i ==…

  • Đếm tần suất 1 kí tự trong 1 file

    # include <stdio.h> # include <string.h> main() { FILE *fp; char in[100]; long int freq[257]; int i; printf("\nFile frequency table generator\n\n"); printf("\nInput file:"); scanf("%s",in); fp=fopen(in,"rb"); if(fp==NULL) { printf("\nCould not open input file.Aborting\n"); return 1; } for(i=0;i<257;i++) freq[i]=0; while(i=fgetc(fp),i!=EOF) { freq[i]++; } fcloseall(); fp=fopen("count.txt","w"); fprintf(fp,"\nCharacter frequency table of %s\n",in); fprintf(fp,"\nCharacter ASCII frequency\n\n"); for(i=0; i<256; i++) {…

  • QUẢN LÝ SINH VIÊN

    [codes=c]#include #include #include #include #define MAX 100#define TOAN 0#define LY   1#define HOA  2 struct sinhvien {  char mslop[5];  char hoten[35];  float diem[3];} danhsach[MAX];int n = 0; void nhapmoi(){  char mslop[5], tmp[3];  int i;  float diem[3];  do {    printf("\nCho biet ma so lop : ");    gets(mslop);    if (strlen(mslop))    {      strcpy(danhsach[n].mslop, mslop);      printf("\nCho biet ho ten : ");      gets(danhsach[n].hoten);      printf("\nCho biet diem so : ");      for (i=0; i<3; i++)      {        scanf("%f", &diem[i]);        danhsach[n].diem[i] = diem[i];      }      gets(tmp);      n++;    }  } while (strlen(mslop));}…

  • DÃY TĂNG DẦN

    #include <stdio.h> void main() { int a[10], i, maxstart, maxend, maxlen, tmpstart, tmpend, tmplen; printf("\nNhap vao 10 phan tu nguyen cua day :"); for (i = 0; i < 10; i++) scanf("%d", & a[i]); printf("Day da cho :\n"); for (i = 0; i < 10; i++) printf("%6d", a[i]); maxstart = maxend = tmpstart = tmpend…

  • CẤU TRÚC VÀ CÁC HÀM THAO TÁC TRÊN SỐ PHỨC

    #include <stdio.h> #include <math.h> void main() { double a, xn, ketqua; printf("\nNhap vao so muon tinh can bac hai : "); scanf("%lf", &a); xn = (a+1)/2; do { ketqua = xn; xn = 0.5 * (xn + a/xn); } while (fabs(xn-ketqua) > 0.0001); printf("\nKet qua = %lf", xn); getch(); }

  • TÍNH CĂN BẬC HAI THEO PHƯƠNG PHÁP LẶP NEWTON [C]

    #include <stdio.h> #include <math.h> void main() { double a, xn, ketqua; printf("\nNhap vao so muon tinh can bac hai : "); scanf("%lf", &a); xn = (a+1)/2; do { ketqua = xn; xn = 0.5 * (xn + a/xn); } while (fabs(xn-ketqua) > 0.0001); printf("\nKet qua = %lf", xn); getch(); }

  • Lý thuyết đồ thị

    Download tại đây:http://www.box.net/public/8ountu3avq