Pagini recente » Cod sursa (job #2165384) | Cod sursa (job #2192402) | Cod sursa (job #2761095) | Cod sursa (job #2558338) | Cod sursa (job #1494174)
#include <fstream>
//#include <iostream>
#include <sstream>
#include <string.h>
using namespace std;
int main()
{
char c;
int l=0, gasit=0, nr=0, i;
ifstream g ("text.in");
ofstream h ("text.out");
stringstream buffer;
buffer << g.rdbuf();
string contents(buffer.str());
for(i=0;i<strlen(contents.c_str());i++)
{
c=contents.c_str()[i];
//cout<<c;
if(((c>=65) && (c<=90)) || ((c>=97) && (c<=122)))
{
l++;
if(!gasit)
nr++;
gasit=1;
}
else gasit=0;
}
//cout<<endl;
//cout<<l<<" "<<nr;
h<<l/nr;
g.close();
h.close();
return 0;
}