Mai intai trebuie sa te autentifici.
Cod sursa(job #681491)
Utilizator | Data | 17 februarie 2012 10:57:20 | |
---|---|---|---|
Problema | Text | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.83 kb |
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
FILE *f;
ofstream g;
int n,i,k,st,ic,sc,s,l;
float med;
char a[100];
int main()
{
f=fopen("text.in","r");
g.open("text.out");
fgets(a,100,f);
// cout<<a;
n=strlen(a);
for(i=0;i<=n;i++)
{
if(isalpha(a[i])) s++;
}
st=0;
ic=0;
sc=0;
k=0;
for(i=0;i<=n;i++)
{
if(isalpha(a[i]))
{
ic=1;
sc=0;
}
else
{
sc=1;
}
if ((ic==1)&&(sc==1))
{
k++;
ic=0;
sc=0;
}
}
// cout<<endl<<s<<" "<<k;
// strupr(a);
//strlwr(a);
// cout<<endl<<a;
// cout<<endl<<s/k;
g<<(s/k);
return 0;
}