_WELCOMETO Radioland

Top50  











.




.








.














> >

: 1/3

//_1-1

#include<iostream.h>

#include<stdio.h>

#include<conio.h>

#include<string.h>

double max(double t[2][3],int*nom)

{

double max=-3e+100,sum=0;

for(int i=0;i<2;i++)

{

for(int j=0;j<3;j++)

sum=sum+t[i][j];

if(sum>=max)

{

*nom=i+1;

max=sum;

sum=0;

}

}

return max;

}

double min(double t[2][3],int *nom)

{

double min=5e+50,sum=0;

for(int i=0;i<2;i++)

{

for(int j=0;j<3;j++)

sum=sum+t[i][j];

if(sum<min)

{

*nom=i+1;

min=sum;

sum=0;

}

}

return min;

}

void main()

{

clrscr();

int n,m;

double t[2][3];

cout<<" "<<endl;

for(int i=0;i<2;i++)

{

for(int j=0;j<3;j++)

{

cin>>t[i][j];

}

}

double a=max(t,&n);

cout<<" :"<<a

<<" "<<n<<endl;

double c=min(t,&m);

cout<<" :"<<c

<<" "<<m<<endl;

getch();

}

 

//1-2

#include<iostream.h>

#include<stdio.h>

#include<conio.h>

void file(FILE*from,FILE*to)

{

char s,kol=0;

while(fscanf(from,"%c",&s)!=EOF)

{

if(s!='.')

{

fprintf(to,"%c",s);

kol++;

if(kol==4)

{

fprintf(to," ");

kol=0;

}

}

else

{

for(kol;kol<4;kol++)

fprintf(to," ");

fprintf(to," ");

kol=0;

}

}

}

void main()

{

FILE*fr;

FILE*to;

fr=fopen("c:/in.txt","r");

if(fr==NULL)

cout<<"Cannot open file"<<endl;

to=fopen("c:/out.txt","w+");

if(to==NULL)

cout<<"Cannot open file"<<endl;

file(fr,to);

fclose(fr);

fclose(to);

}

//_1-3

#include<iostream.h>

#include<stdio.h>

#include<conio.h>

#include<string.h>

void main()

{

clrscr();

char str[1000];

int maxlen=0,i=0,nom[30],j=1;

cout<<" "<<endl;

cin>>str;

for(;;)

{

while(str[i]!=',')

{

if(str[i]=='.')

break;

i++;

}

nom[j]=i+1;

j++;

if(str[i]=='.')

break;

i++;

}

nom[0]=0;

int a=0,s=0;

for(int d=1;d<j;d++)

{

if(nom[d]-nom[d-1]>maxlen)

{

maxlen=nom[d]-nom[d-1];

a=nom[d];s=nom[d-1];

}

}

for(int q=s;q<a-1;q++)

{

cout<<str[q];

}

cout<< " -c : " <<maxlen-1<<"()"<<endl;

getch();

}

//_11-2

#include<iostream.h>

#include<stdio.h>

#include<conio.h>

void file(FILE*from,FILE*to)

{

char s;int d=0;

while(fscanf(from,"%c",&s)!=EOF)

{

if(s!=' ')

{

fprintf(to,"%c",s);

d++;

}

else

{

for(;d<80;d++)

fprintf(to," ");

fprintf(to," ");

d=0;

}

}

for(;d<80;d++)

fprintf(to," ");

}

void main()

{

FILE*fr;

FILE*to;

fr=fopen("c:/in.txt","r");

if(fr==NULL)

cout<<"Cannot open file"<<endl;

to=fopen("c:/in.txt","r+");

if(to==NULL)

cout<<"Cannot open file"<<endl;

file(fr,to);

fclose(fr);

fclose(to);

}

 

 

 

 

 

 

 

 

 

//_11-3

#include<iostream.h>

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

char str[3000];

double b[3000],j=0,i=0,n=0;

cout<<" "<<endl;

while(str[i-1]!='.')

{

cin>>str[i];

i++;

}

i=0;

for(;;i++)

{

if (str[i]=='.')

break;

if(str[i]=='a'||str[i]=='i'||str[i]=='e'||+

+str[i]=='o'||str[i]=='u'||str[i]=='y')

{

b[j]=str[i];

n=++j;

}

}

for(j=0;j<n;j++)

{

if(b[j]=='a')

cout<<"a";

}

for(j=0;j<n;j++)

{

if(b[j]=='e')

cout<<"e";

}

for(j=0;j<n;j++)

{

if(b[j]=='i')

cout<<"i";

}

for(j=0;j<n;j++)

{

if(b[j]=='o')

cout<<"o";

}

for(j=0;j<n;j++)

{

if(b[j]=='u')

cout<<"u";

}

for(j=0;j<n;j++)

{

if(b[j]=='y')

cout<<"y";

}

getch();

}

//_19-2

#include<iostream.h>

#include<stdio.h>

#include<conio.h>

void file(FILE*from)

{

char name[100],*z[100];

int vozr,m=0,j=0;

for(int i=0;fscanf(from,"%s %d",&name,&vozr)!=EOF;i++)

{

z[i]=name;

if(vozr>m)

{

m=vozr;

i=j;

}

}

cout<<z[j]<<" "<<m;

getch();

}

void main()

{

clrscr();

FILE*fr;

fr=fopen("c:/in.txt","r");

if(fr==NULL)

cout<<"Cannot open file"<<endl;

file(fr);

fclose(fr);

}

 

//_2-1

#include<iostream.h>

#include<stdio.h>

#include<conio.h>

int max(char t[3][3])

{

int kol=0,max=0,a=0;

for(int i=0;i<3;i++)

{

for(int j=0;j<3;j++)

{

if(t[i][j]>='0'&&t[i][j]<='9')

{

kol++;

}

}

if(kol>max)

{

max=kol;

a=i;

}

kol=0;

}

if(a==0)

a=-1;

return a;

}

void main()

{

clrscr();

char a[3][3];

cout<<" "<<endl;

for(int i=0;i<3;i++)

{

for(int j=0;j<3;j++)

{

cin>>a[i][j];

}

}

cout<<max(a)+1;

getch();

}

//2-2

#include<iostream.h>

#include<stdio.h>

#include<conio.h>

int file(FILE*from)

{

char a[1000];

int k=0;

for(int i=0,j=0;fscanf(from,"%c",&a[i])!=EOF;i++)

{

if(a[i]==' '&&a[i-1]==a[j])

{

k++;

j=i+1;

i=i+2;

}

else

{

if(a[i]==' ')

j=i+1;

}

}

return k;

}

void main()

{

clrscr();

FILE*fr;

fr=fopen("c:/in.txt","r");

if(fr==NULL)

cout<<"Cannot open file"<<endl;

cout<<file(fr);

fclose(fr);

getch();

}