Pagini recente » Cod sursa (job #1926797) | Cod sursa (job #931462) | Cod sursa (job #2967947) | Cod sursa (job #39445) | Cod sursa (job #1493371)
#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=0;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;
}