Professional Documents
Culture Documents
Word File of Outputs
Word File of Outputs
while(1)
{
printf("%c ",arr[i][j]);
}
printf("\n");
}
break;
}
for(row=0;row<5;row++)
{
for(cols=0;cols<=6-x;i++){
for(col=cols;col<x+cols;col++){
if(arr[row][col]==searchit[col-cols])
{
match++;
}
}
if(match==x)
{
found++;
}
match=0;
}
}
if(found>0)
{
score++;
printf("\n%s found!! Your score == %d",searchit,score);
}
else
{
score--;
printf("\n%s not found!! Your score == %d",searchit,score);
}
}
}
Output:
Q#2 Code:
C-Script
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main()
{
char s[1000], ID[8], store[1500];
printf("Enter your ID:");
gets(ID);
strcat(ID," ");
printf("Type Message for Encryption: ");
strcat(store,ID);
gets(s);
int i = 0, c = 1;
for(i=0;s[i]!='\0';i++)
{
if(s[i]==' ')
c++;
}
else if(x[0]!='a' && x[0]!='e' && x[0]!='i' && x[0]!='o' && x[0]!='u')
{
if(x[0]=='s' && x[1]=='c' && x[2]=='h')
{
x[1]='k';
for(i=0;i<length;i++)
{
if(x[i]=='h')
for(j=i;j<length;j++)
{
x[j] = x[j+1];
}
}
length = length-1;
for(i=0;i<2;i++)
{
char temp = x[0];
for(j=0;j<length-1;j++)
{
x[j] = x[j+1];
}
x[length-1] = temp;
}
strcat(x,"ay ");
}
else
{
for(i=0;i<2;i++)
{
char temp = x[length-1];
for(j=length-1;j>0;j--)
{
x[j] = x[j-1];
}
x[0] = temp;
}
strcat(x,"ay ");
}
}
strcat(store,x);
ptr = strtok(NULL, " ");
}
printf("decrypted message is: ");
puts(store);
}
Output: