Új hozzászólás Aktív témák
-
babyanigirl
csendes tag
#include <stdio.h>
#pragma hdrstop//---------------------------------------------------------------------------
#pragma argsused
int main( int argc, char* argv[] )
{
int i;
FILE* f;
FILE *fp;
int count[256];for(i=0; i<256; i++)
{
count[i] = 0;
}f = fopen("input.txt", "rt");
while(1)
{
int c = fgetc(f);
if( c==EOF )
break;
if( c<0 || c>255 ) {
printf("hiba: nem vart betu");
return 3;
}count[c] += 1;
}fclose(f);
printf("gyakorisagok:\n");
for(i=0; i<256; i++)
{
if( count[i] < 1 )
continue;printf("'%c': %d-szer\n", i, count[i]);
fp=fopen("output.txt", "a+");
fprintf(fp,"Gyakorisága az");
fprintf(fp,"%c betunek %d\n", i, count[i]);
fclose(fp);
}
system("pause");
return 0;
}Mit gondoltok ez így jó?
Nem lehetne vhogy egyszerűbben megcsinálni?
BabyAniGirl
Új hozzászólás Aktív témák
● olvasd el a téma összefoglalót!
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- Bomba ár! HP ProBook 430 G5 - i5-8GEN I 8GB I 256GB SSD I HDMI I 13,3" FHD I Cam I W11 I Garancia!
- Számlás!Windows 10 Pro 11 Pro,Windows 10 Home 11 Home, Office 2016,2019,2021 ,Vírusirtok,Mac
- Apple iPhone 13 Pro Max 128GB, Kártyafüggetlen, 1 Év Garanciával
- AKCIÓ! Lenovo ThinkPad X13 Gen 5 üzleti notebook - Ultra 5 135U 16GB DDR5 512GB SSD Intel Win11
- Intel Core i5-9500 / i5-9500T / i7-8700 / i7-9700 CPU, processzor - Számla, garancia
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest