Thread: drawing lines and rectangles in c++

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    118

    drawing lines and rectangles in c++

    hi im making a program that dependent on the users imputs and the calculations afterward displays a grid.
    the trouble is that i am not sure how to draw lines or rectangles i know that i need to put co-ordinates but i dont really know how to make the line draw on screen.
    oh and another question is my program starts with this code
    Code:
    // PROGRAM TO WORK MATERIALS OUT FOR A CEILING
    
    #include <iostream>
     
    using namespace std;
    bool YesNo(char* prompt)
    {
          cout << prompt;
          char yesno;
          cin.ignore(cin.rdbuf()->in_avail());
          yesno = cin.get();
          cin.ignore(cin.rdbuf()->in_avail());
          return(yesno == 'Y' || yesno == 'y');
    }
    
    int main()
    {
    int long_wall;
    int short_wall;
    int atile, btile, totaltile;
    int runnersinglerow; 
    int rsr, rowsofrunner,totalrunner,theover;
    int a1200a, a1200,b1200a, b1200, total1200;
    int a600,a600a, b600,b600a, total600;
    
    do {
    cout<< "please enter the the length of the longest wall if the\n";
    cout<<" sofit is concerete otherwise enter the length of the wall\n";
    cout<<"opposite the joists.ok ive fixed it now it will work every time :) i hope lol\n";
    cin>>long_wall;
    cin.ignore();
    
    cout<< "now enter the lenght of the other wall.\n";
    cin>>short_wall;
    cin.ignore();
    
           rsr=long_wall%3600;
           runnersinglerow=long_wall/3600;
           rowsofrunner=short_wall/1200;
           theover=rowsofrunner/2; 
               
         if (rsr<1800)
           totalrunner=runnersinglerow*rowsofrunner+theover;       
           
           if (rsr>1800)
           runnersinglerow++;    
           totalrunner=runnersinglerow*rowsofrunner;
           cout<<"you will need... "<<totalrunner<<" runners\n";
              
              
               a1200=(long_wall/600);
               b1200=(short_wall/1200+1);
               total1200=a1200*b1200;
               cout<<"you will need... "<<total1200<<" 1200 bars\n";
                  
                  
                   a600=long_wall/600+1;
                   b600=short_wall/1200+1;
                   total600=a600*b600;
                   cout<<"you will need... "<<total600<<" 600 bars\n";
                        
                        
                        atile=long_wall/600+1;
                        btile=short_wall/600+1;
                        totaltile=atile*btile;
                        cout<<"you will need... "<<totaltile<<" tiles\n";
                        
    cout<<"dont forget this is the proto type lol\n";
    }
    
    while(YesNo("Restart? (Y / Any key) "));
          
          return 0;
    }
    ok so my code works fine but now is it possible to make this same program display graphics? thank you in advance
    oh and by the way just so people dont think im a stealer the yes no part of the code was not wrote by me niether do i at this point really understand it.
    Last edited by thestien; 10-05-2006 at 03:40 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Drawing program architecture - information needed
    By Marko_D in forum Windows Programming
    Replies: 1
    Last Post: 11-28-2003, 07:46 PM
  2. Drawing a triangle with hatch marks?
    By Bajanine in forum Windows Programming
    Replies: 4
    Last Post: 05-19-2003, 05:42 AM