BIPLOVESARKAR
BAN USER<pre lang="" line="1" title="CodeMonkey32219" class="run-this">void find(int b[][4],int m,int n)
{
int i,j,i1,j1,i2,j2,i3,j3;
int c[2][2],sum1,sum2;
sum1=sum2=0;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
i1=i,j1=j;
while(i1<m)
{
i2=i;
j2=j;
sum1=0;
while(1)
{
if(j2==n||j2>j1)
{ j2=j;
i2++;
}
sum1=sum1+b[i2][j2];
j2++;
if(i2==i1&&j2>j1)
break;
}
if(sum1>sum2)
{
c[0][0]=i;
c[0][1]=j;
c[1][0]=i1;
c[1][1]=j1;
sum2=sum1;
}
j1++;
sum1=0;
if(j1==n)
{
j1=j;
i1++;
}
}
}
}
for(i3=c[0][0];i3<=c[1][0];i3++)
{
for(j3=c[0][1];j3<=c[1][1];j3++)
cout<<" "<<b[i3][j3];
cout<<"\n";
}
cout<<" sum:"<<sum2<<"\n";
}</pre><pre title="CodeMonkey32219" input="yes">
</pre>
is this chunk of memory from heap or stack.....????????i think must be from stack.....
- BIPLOVESARKAR August 25, 2011#include<iostream.h>
#include<stdlib.h>
#include<conio.h>
void main()
{
clrscr();
char *ch="abcdejihgfedcba";
int i,j,N=0,i1,j1;
while(ch[N++]!='\0');
N--;
i=j=0;
i1=i;
j1=j;
while(j<=N)
{
if(abs(j-i)>abs(j1-i1))
{
i1=i;
j1=j;
}
i=j;
while(abs(ch[j]-ch[i])==abs(j-i))
{
j++;
}
}
while(i1!=j1)
{
cout<<ch[i1];
i1++;
}
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
long int d=3;
int j=0,a=1;
while(j<9)
{
a=1;
while(a%d!=0)
{
cout<<1;
a=((a%d)*10)+1;
}
cout<<"/"<<d<<"\n";
getch();
d=d-2;
d=d*10+3;
j++;
}
getch();
}
i hope getch() is not a big concern..... yeah you are right i am a 3rd class programmer....!!!! thanks... i love to use getch() in programs....
- BIPLOVESARKAR August 24, 2011
<pre lang="" line="1" title="CodeMonkey51728" class="run-this">#include<iostream.h>
- BIPLOVESARKAR August 25, 2011#include<conio.h>
#include<math.h>
#define cosi(x1,y1,x2,y2) acos((x1*x2+y1*y2)/sqrt((pow(x1,2)+pow(y1,2))*(pow(x2,2)+pow(y2,2))))
void main()
{
clrscr();
int i,f;
char ch='c';
double q1,q2,q3,p[3][2],p1[2],a1,a2;
cout<<"enter the coordinates of triangle\n";
for(i=0;i<3;i++)
cout<<"\rx=",cin>>p[i][0],cout<<" y=",cin>>p[i][1];
do
{
clrscr();
cout<<"\nenter any point";
cout<<"x=",cin>>p1[0],cout<<" y=",cin>>p1[1];
i=0;
f=0;
while(i<3)
{
if(p1[0]==p[i][0]&&p1[1]==p[i][1])
{
f=1;
break;
}
i++;
}
if(f==0)
{
for(i=0;i<3;i++)
{
f=1;
a1=1;
a2=-1;
if(i==1)
a2=2;
else
if(i==3)
a1=-2;
q1=cosi((p[i][0]-p[i+a1][0]),(p[i][1]-p[i+a1][1]),(p[i][0]-p[i+a2][0]),(p[i][1]-p[i+a2][1]));
q2=cosi((p[i][0]-p1[0]),(p[i][1]-p1[1]),(p[i][0]-p[i+a1][0]),(p[i][1]-p[i+a1][1]));
q3=cosi((p[i][0]-p1[0]),(p[i][1]-p1[1]),(p[i][0]-p[i+a2][0]),(p[i][1]-p[i+a2][1]));
if(abs(q1)<(abs(q2)+abs(q3)))
{
f=0;
break;
}
}
}
if(f==1)
cout<<"\ninside the triangle";
else
cout<<"\noutside the triangle";
cout<<"\n\n\n press q to quit";
ch=getch();
}while(ch!='q');
getch();
}
</pre><pre title="CodeMonkey51728" input="yes">
</pre>