Pagini recente » Cod sursa (job #1426072) | Cod sursa (job #2267408) | Cod sursa (job #2115295) | Cod sursa (job #1636786) | Cod sursa (job #499811)
Cod sursa(job #499811)
#include <fstream>
using namespace std;
int main()
{
ifstream input("text.in");
int iTotalLitere = 0;
int iTotalCuvinte = 0;
bool bAvemCuvant = false;
while(input)
{
char chCeva;
input.get(chCeva);
if ((static_cast<int>(chCeva) >= 65 && static_cast<int>(chCeva) <= 90 ) ||
(static_cast<int>(chCeva) >= 97 && static_cast<int>(chCeva) <= 122))
{
iTotalLitere++;
if(!bAvemCuvant)
{
bAvemCuvant = true;
iTotalCuvinte++;
}
}
else
{
bAvemCuvant = false;
}
}
input.close();
ofstream output("text.out");
output << (iTotalLitere / iTotalCuvinte);
output.close();
return 0;
}