Cod sursa(job #2335218)
| Utilizator | Data | 3 februarie 2019 19:17:35 | |
|---|---|---|---|
| Problema | Text | Scor | 20 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <iostream>
#include <string.h>
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char s[255], *p, sep[]="- ,!?/", c[10][10];
int i, j, k, d;
void txt(char s[255], char c[10][10])
{
f.getline(s, 255);
p=strtok(s, sep);
while(p)
{
strcpy(c[k++], p);
p=strtok(NULL, sep);
}
for(i=0;i<k;i++)
{
for(j=0;j<strlen(c[i]);j++)
{
if(!strchr(sep, c[i][j]))d++;
}
}
g<<d/k;
}
int main()
{
txt(s, c);
}
