Click here to Skip to main content
15,920,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Linked List Pin
Erudite_Eric8-Apr-12 7:01
Erudite_Eric8-Apr-12 7:01 
SuggestionRe: Linked List Pin
David Crow8-Apr-12 16:33
David Crow8-Apr-12 16:33 
Questionc Pin
siddharth00077-Apr-12 17:23
siddharth00077-Apr-12 17:23 
AnswerRe: c Pin
Rajesh R Subramanian7-Apr-12 22:43
professionalRajesh R Subramanian7-Apr-12 22:43 
AnswerRe: c Pin
Luc Pattyn8-Apr-12 5:19
sitebuilderLuc Pattyn8-Apr-12 5:19 
AnswerRe: c Pin
Chris Losinger8-Apr-12 6:08
professionalChris Losinger8-Apr-12 6:08 
AnswerRe: c Pin
Wes Aday8-Apr-12 6:18
professionalWes Aday8-Apr-12 6:18 
AnswerRe: c Pin
enhzflep8-Apr-12 7:11
enhzflep8-Apr-12 7:11 
AnswerRe: c Pin
Stephen Hewitt8-Apr-12 21:34
Stephen Hewitt8-Apr-12 21:34 
AnswerRe: c Pin
scramjetter14-Apr-12 15:57
scramjetter14-Apr-12 15:57 
QuestionI want to write a code for dns redirect Pin
cosharp7-Apr-12 14:18
cosharp7-Apr-12 14:18 
QuestionRe: I want to write a code for dns redirect Pin
Randor 8-Apr-12 4:39
professional Randor 8-Apr-12 4:39 
QuestionPointers - help please Pin
jenbren7-Apr-12 12:24
jenbren7-Apr-12 12:24 
AnswerRe: Pointers - help please Pin
Maximilien7-Apr-12 13:41
Maximilien7-Apr-12 13:41 
GeneralRe: Pointers - help please Pin
jenbren7-Apr-12 15:05
jenbren7-Apr-12 15:05 
Question#define question Pin
_Flaviu7-Apr-12 0:36
_Flaviu7-Apr-12 0:36 
AnswerRe: #define question Pin
Richard MacCutchan7-Apr-12 1:36
mveRichard MacCutchan7-Apr-12 1:36 
AnswerRe: #define question Pin
Randor 7-Apr-12 6:51
professional Randor 7-Apr-12 6:51 
GeneralRe: #define question Pin
_Flaviu7-Apr-12 9:14
_Flaviu7-Apr-12 9:14 
GeneralRe: #define question Pin
Randor 7-Apr-12 19:25
professional Randor 7-Apr-12 19:25 
Questionline algorithm in borland c++ Pin
matarz6-Apr-12 13:31
matarz6-Apr-12 13:31 
the following code will not draw vertical lines..but when i comment out the part (top) of the code that draws the other set if lines it is able to draw the vertical lines ...im quite new to programming. am i missing something ? please help!!

XML
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <conio.h>
#include <graphics.h>




void main()
{

   int gd,gm;
   char ch;
   float y,x,m,incx,r,cx,cy,angle;
   float x1,y1,x2,y2,incy;


   gd=DETECT;
   initgraph(&gd,&gm,"c:\\borlandc\\bgi");
   printf("Enter value of X1:");
   scanf("%f", &x1);
   printf("Enter value of Y1:");
   scanf("%f", &y1);
   printf("Enter value of X2:");
   scanf("%f", &x2);
   printf("Enter value of Y2:");
   scanf("%f", &y2);

//this part will draw horizontal, +ve and -ve gradient lines
   do{
   y=( (y2-y1)/(x2-x1) ) * incx+y1;
   x=x1+incx++;
   putpixel((int)x,479-(int)y,YELLOW);

 }  while(x<x2);

  if((x2>x1)&&(y2>=y1))
 {
   incx=1;
 }
  if((x2<x1)&&(y2<=y1))
 do {
   y=( (y2-y1)/(x2-x1) ) * incx+y1;
   x=x1+incx--;
   putpixel((int)x,479-(int)y,YELLOW);
 } while(x>x2);





//this part of the code will draw vertical lines


  do {

   x=( (x2-x1)/(y2-y1) ) * incy+x1;
   y=y1+incy++;

   putpixel((int)x,479-(int)y,YELLOW);


 } while(y<y2);

 if((x2==x1)&&(y2>y1))
 {
   incy=1;
 }
 else

 do{
   x=( (x2-x1)/(y2-y1) ) * incy+x1;
   y=y1+incy--;
    putpixel((int)x,479-(int)y,YELLOW);

 } while(y>y2);


   ch=getch();
   closegraph();

 }<code></code>

AnswerRe: line algorithm in borland c++ Pin
David Crow6-Apr-12 15:31
David Crow6-Apr-12 15:31 
AnswerRe: line algorithm in borland c++ Pin
Luc Pattyn6-Apr-12 16:12
sitebuilderLuc Pattyn6-Apr-12 16:12 
Questionread/writing Linked List to a random access file in c++ Pin
djgmad6-Apr-12 12:47
djgmad6-Apr-12 12:47 
AnswerRe: read/writing Linked List to a random access file in c++ Pin
David Crow6-Apr-12 15:34
David Crow6-Apr-12 15:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.