Pagini recente » Cod sursa (job #2833074) | Cod sursa (job #1368583) | Cod sursa (job #2519140) | Cod sursa (job #2315392) | Cod sursa (job #1493369)
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
ifstream fi("text.in");
ofstream fo("text.out");
int main()
{
int i, gasit = 0, ltotal=0, nrcuvinte=0;
char a;
string text;
getline(fi,text);
for(i=1;i<text.length();i++)//65-90 + 97-122
{
a = text.at(i);
if((text.at(i)>=65)&&(text.at(i)<=122))
{
ltotal++;
gasit = 1;
}
else if(((text.at(i) == ' ')||(text.at(i)== '-'))&&(gasit==1))
{
nrcuvinte++;
gasit = 0;
}
if(((text.at(i)=='.')||(text.at(i)=='!')||(text.at(i)=='?'))&&(gasit==1))
nrcuvinte++;
}
fo<<ltotal/nrcuvinte;
return 0;
}