Cod sursa(job #2981137)
| Utilizator | Data | 17 februarie 2023 12:18:47 | |
|---|---|---|---|
| Problema | Text | Scor | 70 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.76 kb |
#include <iostream>
#include <fstream>
#include <cstdio>
using namespace std;
#define infile "text.in"
#define outfile
int main()
{
/*ifstream f (infile);*/
ofstream g("text.out");
char c;
bool start_word;
unsigned long long wCount=0, cCount=0;
FILE* inFile=fopen (infile,"r");
do
{
c = fgetc(inFile);
if (!start_word)
{
if (isalpha(c))
{
wCount++;
cCount++;
start_word = true;
}
}
else
{
if (!isalpha(c)) start_word=false;
else{
cCount++;
}
}
} while (c != EOF);
g<<cCount/wCount;
return 0;
}
