Cod sursa(job #2775582)
Utilizator | Lysander Pitu lysus | Data | 16 septembrie 2021 14:30:41 |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <iostream>
#include<fstream>
#include <string.h>
#include <ctype.h>
using namespace std;
int main()
{
char a[101], *p,sep[]=" ";
int i=0;
ifstream f("text.in");
ofstream g("text.out");
f.get(a,101);
int nrl=0,nrc=0;
for (i=0; i<strlen(a); i++)
if(isalpha(a[i]))
nrl++;
p=strtok(a,sep);
while (p!=NULL)
{
nrc++;
p=strtok(NULL,sep);
}
g << nrl/nrc;
f.close();
g.close();
}