Arama butonu
Bu konudaki kullanıcılar: 1 misafir, 1 mobil kullanıcı
0
Cevap
918
Tıklama
0
Öne Çıkarma
ARKADAŞLAR LÜTFEN YARDIM EDİN 'C' DOSYA KONTROL ETTİRMEK İSTİYORUM BAŞARAMADIM
J
16 yıl
Yüzbaşı
Konu Sahibi

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

DH forumlarında vakit geçirmekten keyif alıyor gibisin ancak giriş yapmadığını görüyoruz.

Üye olduğunda özel mesaj gönderebilir, beğendiğin konuları favorilerine ekleyip takibe alabilir ve daha önce gezdiğin konulara hızlıca erişebilirsin.

Üye Ol Şimdi Değil



DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.