wklejamy.pl website for sale. You are interested in. Please contact. wklejamy@gmail.com
Click to buy coffe
Untitled
Guest 165 22nd Nov, 2022
#include <iostream>
#include <fstream>
using namespace std;
void pierwszy()
{
int t[9]={0,0,0,0,0,0,0,0,0};
string line;
ifstream file("dane6.txt");
int m;
while (getline (file, line)) {
m=0;
for(int j=0;j<100;j++)
if((int(line[j])-48)>m)
m=(int(line[j])-48);
t[m-1]++;
}
for(int i=0;i<9;i++)
cout<<i+2<<". "<<t[i]<<endl;
file.close();
}
void drugi()
{
int t[9]={0,0,0,0,0,0,0,0,0};
string s[9];
string line;
ifstream file("dane6.txt");
int m;
int max;
while (getline (file, line)) {
m=0;
max=0;
for(int j=0;j<100;j++)
{
max+=(int(line[j])-48);
if((int(line[j])-48)>m)
m=(int(line[j])-48);
}
if(t[m-1]<max)
{
t[m-1]=max;
s[m-1]=line;
}
}
for(int i=0;i<9;i++)
cout<<i+2<<". "<<s[i]<<endl;
file.close();
}
void trzeci()
{
ifstream file("dane6.txt");
bool f;
string line;
int n=100;
while (getline (file, line)) {
f=true;
for(int i=0;i<n/2;i++)
{
f=!(line[i]==line[n-i-1]);
if(!f)
break;
}
if(f)
cout<<line<<endl;
}
}
int main()
{
cout<<"6.1"<<endl;
pierwszy();
cout<<endl<<endl<<"6.2"<<endl;
drugi();
cout<<endl<<endl<<"6.3"<<endl;
trzeci();
return 0;
}
To share this paste please copy this url and send to your friends
RAW Paste Data