===========================================================================
CODING
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<stdio.h>
#include<process.h>
#include<all.h>
void main()
{
clrscr();
first();
second();
int a[20],j,i,x,y,t,m[10],n=1;
textcolor(WHITE);
gotoxy(1,1);
cprintf("Enter nos.: ");
for(i=0,x=16;i<=10;i++,x+=5)
{
gotoxy(x,1);
cscanf("%d",&a[i]);
}
for(;n!=0;)
{
gotoxy(1,3);
cprintf("What do you want to Search: ");
cscanf("%d",&n);
for(i=0,j=0,t=15,x=1,y=8;i<=10;i++,t=15,x+=5)
{
textcolor(WHITE);
gotoxy(x+2,y-1);
cprintf("%d",i);
if(i==0)
{
gotoxy(x,y);
cprintf("ÕÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x+2,y+1);
textcolor(t);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(x,y+2);
cprintf("ÔÍÍÍÍ");
}
else if(i==10)
{
gotoxy(x,y);
cprintf("ÑÍÍÍ͸");
gotoxy(x,y+1);
cprintf("³ ³");
gotoxy(x+2,y+1);
textcolor(t);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(x,y+2);
cprintf("ÏÍÍÍ;");
}
else
{
gotoxy(x,y);
cprintf("ÑÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x+2,y+1);
textcolor(t);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(x,y+2);
cprintf("ÏÍÍÍÍ");
}
if(n==a[i])
{
j++;
m[j-1]=i;
}
}
gotoxy(1,12);
cprintf("\"%d\" has occured %d times",n,j);
for(i=1;i<=j;i++)
{
if(i==j)
cprintf(" at %d",m[i-1]);
else
cprintf(" at %d and",m[i-1]);
}
getch();
getch();
gotoxy(29,3);
cprintf(" ");
gotoxy(1,12);
cprintf(" ");
}
}
CODING
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<stdio.h>
#include<process.h>
#include<all.h>
void main()
{
clrscr();
first();
second();
int a[20],j,i,x,y,t,m[10],n=1;
textcolor(WHITE);
gotoxy(1,1);
cprintf("Enter nos.: ");
for(i=0,x=16;i<=10;i++,x+=5)
{
gotoxy(x,1);
cscanf("%d",&a[i]);
}
for(;n!=0;)
{
gotoxy(1,3);
cprintf("What do you want to Search: ");
cscanf("%d",&n);
for(i=0,j=0,t=15,x=1,y=8;i<=10;i++,t=15,x+=5)
{
textcolor(WHITE);
gotoxy(x+2,y-1);
cprintf("%d",i);
if(i==0)
{
gotoxy(x,y);
cprintf("ÕÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x+2,y+1);
textcolor(t);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(x,y+2);
cprintf("ÔÍÍÍÍ");
}
else if(i==10)
{
gotoxy(x,y);
cprintf("ÑÍÍÍ͸");
gotoxy(x,y+1);
cprintf("³ ³");
gotoxy(x+2,y+1);
textcolor(t);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(x,y+2);
cprintf("ÏÍÍÍ;");
}
else
{
gotoxy(x,y);
cprintf("ÑÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x+2,y+1);
textcolor(t);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(x,y+2);
cprintf("ÏÍÍÍÍ");
}
if(n==a[i])
{
j++;
m[j-1]=i;
}
}
gotoxy(1,12);
cprintf("\"%d\" has occured %d times",n,j);
for(i=1;i<=j;i++)
{
if(i==j)
cprintf(" at %d",m[i-1]);
else
cprintf(" at %d and",m[i-1]);
}
getch();
getch();
gotoxy(29,3);
cprintf(" ");
gotoxy(1,12);
cprintf(" ");
}
}
===========================================================================
No comments:
Post a Comment