Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #16  
Old June 15th, 2002, 01:51 PM
suhailkaleem suhailkaleem is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 9 suhailkaleem User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
no ! it is not for a class i was getting bored so i decided to make some thing , so i tried out this but unluckly i got stuck so that is why i am asking you people to help me ,

and thanks Nichademus for giving it a try

any body else who would like to help me !

suhailkaleem

Reply With Quote
  #17  
Old June 17th, 2002, 09:34 AM
Michael_Bray Michael_Bray is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: Sydney, NSW, Australia
Posts: 40 Michael_Bray User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Send a message via ICQ to Michael_Bray
First off to make sure its a square you'll want to make sure that the two diagonals of the square have the same length. Easiest way to make sure its a square.

Think about pythagorus to do this. I could give you a formula, but from what I have read you wouldn't understand it. Have a think about pythagorus and how you can use it to find the length of the diagnols, then sub in the (x,y) values to your working...

If you want the square to be "flat", as in not on an angle, Y1 will equal Y2, and X1 will equal X3, with the coordinates being

(x1,y1) (x2,y2)
(x3,y3) (x4,y4)

Hope that helps.
__________________
Cheers,
Michael Bray

Reply With Quote
  #18  
Old June 17th, 2002, 12:34 PM
suhailkaleem suhailkaleem is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 9 suhailkaleem User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
here is the code

i already know the lengs of the sides ,
ok here is the code see for yr self wat i am trying to tell you !


*************************************************

#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)

{
clrscr();
int vary =9 ,varx =15 ,var_d =5;
int x,y,y1,x1,x2,y2,x3,y3,key,key2,key3,key_d=1,key_l=varx,key_u=vary,key_r=1,z ;


y =var_d ;
x=var_d ;
do
{
key3 =getch();


char t ='.',mask='ì',vars='l',sm ='*' ;
y1 =var_d ;
for (y3=0 ;y3<vary ; y3++ )
{
x1 =var_d ;
for(x3=0;x3<varx;x3++)
{
gotoxy(x1,y1);
textcolor(RED);
printf("%c",t);
x1=x1+var_d ;
}
y1=y1+var_d ;

}

do
{
//vars ='l' ;
// printf ("%c", vars );
key =getch ();
if (key =='x')
{
exit(1) ;
}
if (key==80)
if ( key_d < vary)
if (vars !='s')
{

{
{
key_d ++ ;
key_u--;

y =y+var_d;
gotoxy(x,y);
printf (" ") ;
gotoxy(x,y);
printf("%c",mask);
y=y-var_d ;
gotoxy(x,y) ;
printf("%c",t);
y=y+var_d;

gotoxy(10,40);
printf("x=%d ,y=%d",x,y);


}
}
}
if (key==72)
if( key_u < vary)
if ( vars !='s')
{
{
{
key_u++ ;
key_d--;

y =y-var_d;
gotoxy(x,y);
printf (" ") ;
gotoxy(x,y);
printf("%c",mask);
y=y+var_d ;
gotoxy(x,y);
printf("%c",t);
y=y-var_d;
gotoxy(10,40);
printf("x=%d ,y=%d",x,y);

}
}

}
if ( key==77 )

if ( key_r < varx )
if (vars !='s' )
{
{
{
key_r++;
key_l --;

x =x+var_d;
gotoxy(x,y);
printf (" ") ;
gotoxy(x,y);
printf("%c",mask);
x=x-var_d ;
gotoxy(x,y);
printf("%c",t);
x=x+var_d ;

gotoxy(10,40);
printf("x=%d ,y=%d",x,y);
}
}
}

if (key==75)
if ( key_l < varx)
if (vars != 's')
{
{
{
key_l++;
key_r--;

x =x-var_d;
gotoxy(x,y);
printf (" ") ;
gotoxy(x,y);
printf("%c",mask);
x=x+var_d ;
gotoxy(x,y) ;
printf("%c",t);
x=x-var_d;
gotoxy(10,40);
printf("x=%d ,y=%d",x,y);
}
} }


}



while (key!=13) ;





x2= x;
y2= y ;


do
{


if (key == 13)
{
vars ='s';
{

key2 =getch();
if (key2 =='x')
{
exit(1) ;
}
if ( key2==80)

if (vars =='s')
{
{

y=y-var_d ;
gotoxy(x,y) ;
printf("%c",sm);
x=x+var_d ;
y=y+var_d ;
gotoxy(x,y);
printf("%c",sm);
x=x-2*var_d ;
gotoxy(x,y);
printf("%c",sm);
x=x+var_d;
y=y+var_d ;
gotoxy(x,y);
printf("%c",mask);
y=y-var_d ;
key2 = getch();
if (key2 ==13)
{

for ( z =0 ; z <=var_d ; z++)
{
gotoxy(x2,y2);
printf ("|");
y2++ ;

}
// y2=y2-var_d ;
// int n=y2+var_d ;
// int p=0 ;
//int array[100] ;
// array[p] = n ;

// printf("%d",array[p]);
//p++ ;


vars='l' ;
}
}
}
if ( key2==72)
if (vars =='s')
{
{
y=y-var_d ;
gotoxy(x,y) ;
printf("%c",mask);
x=x+var_d ;
y=y+var_d ;
gotoxy(x,y);
printf("%c",sm);
x=x-2*var_d ;
gotoxy(x,y);
printf("%c",sm);
x=x+var_d;
y=y+var_d ;
gotoxy(x,y);
printf("%c",sm);
y=y-var_d ;

key2 = getch();
if (key2 ==13)
{

for ( z =0 ; z <=var_d ; z++)
{
gotoxy(x2,y2);
printf ("|");
y2-- ;
}
y2=y2+var_d ;
vars='l' ;
}

}
}

if ( key2==77)
if (vars =='s')
{
{
y=y-var_d ;
gotoxy(x,y) ;
printf("%c",sm);
x=x+var_d ;
y=y+var_d ;
gotoxy(x,y);
printf("%c",mask);
x=x-2*var_d ;
gotoxy(x,y);
printf("%c",sm);
x=x+var_d;
y=y+var_d ;
gotoxy(x,y);
printf("%c",sm);
y =y-var_d ;



key2 = getch();
if (key2 ==13)
{
for ( z =0 ; z <=var_d ; z++)
{
gotoxy(x2,y2);
printf ("-");
x2++ ;
}
x2 =x2-var_d ;
vars='l' ;
}
}
}


if ( key2==75)
if (vars =='s')
{
{
y=y-var_d ;
gotoxy(x,y) ;
printf("%c",sm);
x=x+var_d ;
y=y+var_d ;
gotoxy(x,y);
printf("%c",sm);
x=x-2*var_d ;
gotoxy(x,y);
printf("%c",mask);
x=x+var_d;
y=y+var_d ;
gotoxy(x,y);
printf("%c",sm);
y=y-var_d;



key2 = getch();
if (key2 ==13)
{
for ( z =0 ; z <=var_d; z++)
{
gotoxy(x2,y2);
printf ("-");
x2-- ;
}
x2 =x2+var_d ;
vars='l' ;
}

}
}

}
}


}

while (vars!='l');
}
while (key3!='x');

}



*************************************************


the code runs on tc ,
u will know wat the codes do if anything is not clear do ask me
suhailkaleem

Reply With Quote
  #19  
Old June 19th, 2002, 02:59 PM
suhailkaleem suhailkaleem is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 9 suhailkaleem User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
no help ?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > x , y coordinates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT