#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{
int l,flag=1,i;
char s[100];
cout<<"Enter the string:";
gets(s);
l=strlen(s);
for(i=0;(i<l/2)&&(flag==1);i++)
if(s[i]!=s[l/2+i])
flag=0;
if(flag==1)
cout<<"Yes!";
else
cout<<"No!";
getch();
}
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
int same(char s1[100],char s2[100])
{
int l1,l2,i,flag=1;
l1=strlen(s1);
l2=strlen(s2);
if(l1!=l2)
return 0;
else
{
for(i=0;i<l1;i++)
if(s1[i]!=s2[i])
flag=0;
if(flag==1)
return 1;
else
return 0;
}
}
int f(int r,char s[100],char list[50][50],int n)
{
int i;
for(i=0;i<n;i++)
if(same(s,list[i])==1)
return i;
}
void main()
{
int n,i,r,k,rank[100];
char ch[100],l[50][50];
cout<<"Enter n:";
cin>>n;
for(i=0;i<n;i++)
{
cout<<"Enter family:";
gets(l[i]);
cout<<"Enter rank:";
cin>>rank[i];
}
cout<<"Enter the family name & rank:";
gets(ch);
cin>>r;
cout<<endl<<"Output:"<<endl;
k=f(r,ch,l,n);
for(i=0;i<k;i++)
cout<<l[i]<<":"<<rank[i]<<endl;
cout<<l[k]<<":"<<rank[k]<<","<<r<<endl;
for(i=k+1;i<n;i++)
cout<<l[i]<<":"<<rank[i]<<endl;
getch();
}
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
int same(char s1[100],char s2[100])
{
int l1,l2,i,flag=1;
l1=strlen(s1);
l2=strlen(s2);
if(l1!=l2)
return 0;
else
{
for(i=0;i<l1;i++)
if(s1[i]!=s2[i])
flag=0;
if(flag==1)
return 1;
else
return 0;
}
}
int f(int r,char s[100],char list[50][50],int n)
{
int i,flag=1;
for(i=0;i<n;i++)
if(same(s,list[i])==1)
{
return i;
flag=0;
}
if(flag==1)
return n;
}
void main()
{
int n,i,r,k,rank[100];
char ch[100],l[50][50];
cout<<"Enter n:";
cin>>n;
for(i=0;i<n;i++)
{
cout<<"Enter family:";
gets(l[i]);
cout<<"Enter rank:";
cin>>rank[i];
}
cout<<"Enter the family name & rank:";
gets(ch);
cin>>r;
cout<<endl<<"Output:"<<endl;
k=f(r,ch,l,n);
if(k!=n)
{
for(i=0;i<k;i++)
cout<<l[i]<<":"<<rank[i]<<endl;
cout<<l[k]<<":"<<rank[k]<<","<<r<<endl;
for(i=k+1;i<n;i++)
cout<<l[i]<<":"<<rank[i]<<endl;
}
else
{
for(i=0;i<k;i++)
cout<<l[i]<<":"<<rank[i]<<endl;
cout<<ch<<":"<<r;
}
getch();
}
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<ctype.h>
main()
{
int l,i,j;
char s[100],t;
cout<<"Enter your string:";
gets(s);
l=strlen(s);
for(i=0;i<l;i++)
s[i]=tolower(s[i]);
for(i=l-1;i>=0;i--)
for(j=0;j<i;j++)
if(s[i]<s[j])
{
t=s[i];
s[i]=s[j];
s[j]=t;
}
cout<<s;
getch();
}