Şimdi Ara

ARKADAŞLAR LÜTFEN YARDIM EDİN 'C' DOSYA KONTROL ETTİRMEK İSTİYORUM BAŞARAMADIM

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
2 Misafir - 2 Masaüstü
5 sn
1
Cevap
0
Favori
807
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • Arkadaşlar lütfen bi yardım edin çok çok acil....

    1 ve 2 adım tamam ama 3 adımda takıldım bir türlü yapamadım yardımlarınız için teşekkürler...
    yapmak istediğim illeri karşılaştırmak ismi aynı olanları değilde aynı olmayanları line by line olarak kontrol ettirmek istiyorum ama bir türlü yapamadım.



    char buff[MAX_LEN];

    while(fgets(buff, MAX_LEN, fin) != NULL)

    fputs(buff, fout);

    }

    Step 1: Study the example code given above and understand how it works.

    Step 2: Write a simple C program which compares two strings buff1 and buff2. In other words, if the two strings are identical then it should print “the two strings are identical” else if the two strings differ then it should print “the two strings are different” to the standard output. Hint: use the function strcmp() which is already available in the standard C library, when necessary. (For your own practice)

    Step3: Having fully understood the code given in Step 1 and having successfully written a working code in Step 2, write a C program which compares two files “file1.txt” and “file2.txt” which have same number of lines (for simplicity) but may have different contents.

    Your program should be comparing two files line by line where each line is treated as a string. If all the lines of the two files are identical then your program should print “the two files are identical” to the standard output. Else if any two (or more) lines are different then your program should produce appropriate informative outputs to the standard output.

    Note 1: You can use strcmp() function when necessary.

    Note 2: You can use the code given in step1 as a baseline and make necessary modifications on it as your homework.

    Submit this final version (Step 3) of your program as your homework!!

    DO NOT forget to obey to the Homework Submission Format which was posted before (Please check again BIL104E (For Everyone) News Forum)

    Chekout this example:

    File1: File2:

    ADANA ADANA

    ADIYAMAN BALIKESIR

    AFYON AFYON

    AGRI AGRI

    AMASYA AMASYA

    ANKARA ISTANBUL

    ANTALYA ANTALYA

    ARTVIN ARTVIN

    AYDIN AYDIN

    The output for these two files would be:

    The files differ at line 2:

    In file1: ADIYAMAN

    In file2: BALIKESIR

    The files differ at line 6:

    In file1: ANKARA

    In file2: ISTANBUL







  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.