#include <iostream>
#include <conio.h>
#include <fstream>
#include <string>
#include <math.h>
using namespace std;
int fx (string t)
{
int i,A=0,b=0,x;
for(i=t.size()-1;i>=0;i--,b++)
{
x=t[i]-'0';
A=A+x*pow(10,b);
}
return A;
}
int main()
{
int lp=0,i=0,e,b,c,a=0,MAX,MIN,max,min,l,j=0;
string txt;
ifstream tekst("cyfry.txt");
ofstream plik;
plik.open("rozwiazanie.txt");
plik << "Liczby ktore tworza ciag rosnacy: ";
if(tekst.is_open())
{
while(tekst.good())
{
getline(tekst,txt);
a=0;
if(txt.size())
{
l=0;
for(j=0;j<txt.size()-1;j++)
{
if(txt[j]<txt[j+1])
l++;
}
c=txt.size()-1;
if(l==c)
{
cout << txt << " ";
plik << txt << " ";
}
e=fx(txt);
if(e%2==0)
lp++;
c=e;
while(c>=1)
{
b=c%10;
a=a+b;
c=c/10;
}
if(i==0)
{
max=a;
MAX=e;
min=a;
MIN=e;
i++;
}
else
{
if(a>max)
{
max=a;
MAX=e;
}
if(a<min)
{
min=a;
MIN=e;
}
}
}
}
tekst.close();
}
cout << "\nLiczb parzystych w pliku jest: " << lp << endl;
cout << "Liczba, ktorej suma cyfr jest najwieksza: " << MAX << endl;
cout << "Liczba, ktorej suma cyfr jest najmniejsza: " << MIN << endl;
plik << endl << "Liczb parzystych w pliku jest: " << lp << endl;
plik << "Liczba, ktorej suma cyfr jest najwieksza: " << MAX << endl;
plik << "Liczba, ktorej suma cyfr jest najmniejsza: " << MIN << endl;
plik.close();
getch();
return 0;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}