Cod sursa(job #2116242)
Utilizator | Data | 27 ianuarie 2018 13:59:18 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int i,n,c,L;
char s[255],*p,a[101][255];
int main()
{
f.getline(s,255);
L=strlen(s);
for(i=0;i<L;i++)
if((s[i]>='A'&&s[i]<='Z')|(s[i]>='a'&&s[i]<='z')) c++;
p=strtok(s," ");
while(p!=NULL)
{n++;
strcpy(a[n],p);
p=strtok(NULL," ");
}
if(n!=0) g<<c/n;
else g<<"eroare";
return 0;
}