473,805 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c without usin any graphics function

if u give cordinates to programme at run time and want a line to be
drawn.. how to do this in c without usin any graphics function?
like x1,y1 and x2,y2
and lines should be drawn from the 1st co-ordinate to 2nd one

any pointer would be appreciated

Thanks

Sep 6 '07
43 1927
On Sep 5, 11:50 pm, shaanxxx <shaan...@yahoo .comwrote:
if u give cordinates to programme at run time and want a line to be
drawn.. how to do this in c without usin any graphics function?
like x1,y1 and x2,y2
and lines should be drawn from the 1st co-ordinate to 2nd one

any pointer would be appreciated

Thanks
#include<stdio. h>
#include<conio. h>

void main()
{
int b=176;
textcolor(8); // Use this inbuilt function in C to change the color
of text
textbackground( 123); /* use this inbuilt function to change the color
of background screen just change the argument passed to the function
color of screen will change depending upon the graphics card installed
and monitors color support */

for(b=176;b<224 ;b++)
{
printf("\n\t %c",b);
}

/* Above for loop will print the characters available in C for
graphics programming
you can use these characters to design GUI (graphical user interface)
for your application.
Even The turboc Editor can be designed with the above characters. Just
you have to use the for
and while loop properly */
getch();

}
For More C Source Codes and tutorials refer
http://zsoftwares.googlepages.com/CPrograms.html

Sep 7 '07 #11
ge*******@gmail .com writes:
On Sep 5, 11:50 pm, shaanxxx <shaan...@yahoo .comwrote:
>if u give cordinates to programme at run time and want a line to be
drawn.. how to do this in c without usin any graphics function?
like x1,y1 and x2,y2
and lines should be drawn from the 1st co-ordinate to 2nd one

any pointer would be appreciated

Thanks

#include<stdio. h>
#include<conio. h>
This header is non-standard.
void main()
Wrong. main returns int.
{
int b=176;
textcolor(8); // Use this inbuilt function in C to change the color
of text
There is no 'textcolor' function in standard C.
textbackground( 123); /* use this inbuilt function to change the color
of background screen just change the argument passed to the function
color of screen will change depending upon the graphics card installed
and monitors color support */
There is no 'textbackground ' function in standard C.
for(b=176;b<224 ;b++)
{
printf("\n\t %c",b);
}

/* Above for loop will print the characters available in C for
graphics programming
you can use these characters to design GUI (graphical user interface)
for your application.
Even The turboc Editor can be designed with the above characters. Just
you have to use the for
and while loop properly */
This is entirely system-specific.
getch();
There is no 'getch' function in standard C.
>
}
For More C Source Codes and tutorials refer
http://zsoftwares.googlepages.com/CPrograms.html
How many times do you intend to advertise this site? Once was more
than enough.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Sep 7 '07 #12
shaanxxx wrote:
) if u give cordinates to programme at run time and want a line to be
) drawn.. how to do this in c without usin any graphics function?
) like x1,y1 and x2,y2
) and lines should be drawn from the 1st co-ordinate to 2nd one
)
) any pointer would be appreciated

What do you want the line to be drawn on ? Be very specific.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
Sep 7 '07 #13
In article <ln************ @nuthaus.mib.or g>, Keith Thompson
<ks***@mib.orgw rites
>ge*******@gmai l.com writes:
>On Sep 5, 11:50 pm, shaanxxx <shaan...@yahoo .comwrote:
>>if u give cordinates to programme at run time and want a line to be
drawn.. how to do this in c without usin any graphics function?
like x1,y1 and x2,y2
and lines should be drawn from the 1st co-ordinate to 2nd one

any pointer would be appreciated

Thanks

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

This header is non-standard.
A more useful comment is that this only works on and MS platform?
>void main()
Wrong. main returns int.
Not always but if we are assuming "conio.h" then it should
>{
int b=176;
textcolor(8); // Use this inbuilt function in C to change the color
of text
There is no 'textcolor' function in standard C.
He is apparently using an MS platform. If you can't tell that perhaps
you should not be giving any advice.
> for(b=176;b<224 ;b++)
{
printf("\n\t %c",b);
}

/* Above for loop will print the characters available in C for
graphics programming
you can use these characters to design GUI (graphical user interface)
for your application.
Even The turboc Editor can be designed with the above characters. Just
you have to use the for
and while loop properly */

This is entirely system-specific.
So what?

To quote PJP in May 2006
//////////////////////////////////
* People who know the value of writing portable code know to follow
standards. Those who don't simply don't, and mostly don't care, and
mostly benefit from using the nonstandard extensions. So what's the big
deal?
////////////////////////////
>For More C Source Codes and tutorials refer
http://zsoftwares.googlepages.com/CPrograms.html

How many times do you intend to advertise this site? Once was more
than enough.
Et too... No need to keep up the "this is not standard C" mantra Either
be helpful or don't get involved.

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys. org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Sep 7 '07 #14
Chris Hills <ch***@phaedsys .orgwrote:
In article <ln************ @nuthaus.mib.or g>, Keith Thompson
<ks***@mib.orgw rites
ge*******@gmail .com writes:
On Sep 5, 11:50 pm, shaanxxx <shaan...@yahoo .comwrote:
if u give cordinates to programme at run time and want a line to be
drawn.. how to do this in c without usin any graphics function?
like x1,y1 and x2,y2
and lines should be drawn from the 1st co-ordinate to 2nd one

any pointer would be appreciated

#include<stdio. h>
#include<conio. h>
This header is non-standard.

A more useful comment is that this only works on and MS platform?
_Some_ M$ platforms.
textcolor(8); // Use this inbuilt function in C to change the color
of text
There is no 'textcolor' function in standard C.

He is apparently using an MS platform. If you can't tell that perhaps
you should not be giving any advice.
Or perhaps Mr. georgerzx should not be using terms like "inbuilt
function in C".
Et too... No need to keep up the "this is not standard C" mantra Either
be helpful or don't get involved.
Pointing out that code given out may well not work on the OP's platform
is very helpful.

Richard
Sep 7 '07 #15
Chris Hills said:
In article <ln************ @nuthaus.mib.or g>, Keith Thompson
<ks***@mib.orgw rites
<snip>
>>#include<stdi o.h>
#include<coni o.h>

This header is non-standard.

A more useful comment is that this only works on and MS platform?
Nothing in the rules says that <conio.hcan't be used for any purpose
on any platform. It's perfectly legal to release a library on a
Microsoft platform (or on any other platform) that publishes its
interface via a header named <conio.h>, no matter what functionality
that library provides, graphical or otherwise.
>>void main()
Wrong. main returns int.

Not always but if we are assuming "conio.h" then it should
Whether main may return something other than int does *not* depend on
the availability or otherwise of a header named <conio.h>, but on
whether the implementation is a hosted C90 implementation.
>>{
int b=176;
textcolor(8); // Use this inbuilt function in C to change the color
of text
There is no 'textcolor' function in standard C.

He is apparently using an MS platform. If you can't tell that perhaps
you should not be giving any advice.
I agree that it is likely that he's using Turbo C under MS-DOS or
MS-Windows, but the C Standard does not guarantee this.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Sep 7 '07 #16
In article <Pc************ *************** ***@bt.com>, Richard Heathfield
<rj*@see.sig.in validwrites
>Chris Hills said:
ise.
>>>void main()
Wrong. main returns int.

Not always but if we are assuming "conio.h" then it should

Whether main may return something other than int does *not* depend on
the availability or otherwise of a header named <conio.h>, but on
whether the implementation is a hosted C90 implementation.
A hosted C90 platform... however if he is using conio I think it is
fairly safe to assume he is on an MS platform so it should return an Int
>>>{
int b=176;
textcolor(8); // Use this inbuilt function in C to change the color
of text
There is no 'textcolor' function in standard C.

He is apparently using an MS platform. If you can't tell that perhaps
you should not be giving any advice.

I agree that it is likely that he's using Turbo C under MS-DOS or
MS-Windows, but the C Standard does not guarantee this.
The C standard is not relevant at this point. What is relevant that he
constructs a good program using C with the extensions available for his
platform. Portability is a non issue here.


--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys. org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Sep 7 '07 #17
Richard Heathfield wrote:
Chris Hills said:
>In article <ln************ @nuthaus.mib.or g>, Keith Thompson
<ks***@mib.org writes
>>>void main()
Wrong. main returns int.
Not always but if we are assuming "conio.h" then it should

Whether main may return something other than int does *not* depend on
the availability or otherwise of a header named <conio.h>, but on
whether the implementation is a hosted C90 implementation.
Even on a freestanding implementation main may be required to return int.

Are hosted implementations free to accept void main(void) if they wish?
Obviously they must still accept int main(void).

--
Philip Potter pgp <atdoc.ic.ac. uk
Sep 7 '07 #18
Chris Hills said:
In article <Pc************ *************** ***@bt.com>, Richard
Heathfield <rj*@see.sig.in validwrites
>>Chris Hills said:
ise.
>>>>void main()
Wrong. main returns int.

Not always but if we are assuming "conio.h" then it should

Whether main may return something other than int does *not* depend on
the availability or otherwise of a header named <conio.h>, but on
whether the implementation is a hosted C90 implementation.

A hosted C90 platform...
The C Standard doesn't define, or even use, the term "platform", so we
can't guarantee that we are using the word in the same way.
however if he is using conio I think it is
fairly safe to assume he is on an MS platform so it should return an
Int
int (C doesn't define the term "Int"). In my previous reply I pointed
out why your assumption is not necessarily correct.
>
>>>>{
int b=176;
textcolor(8); // Use this inbuilt function in C to change the
color
of text
There is no 'textcolor' function in standard C.

He is apparently using an MS platform. If you can't tell that
perhaps you should not be giving any advice.

I agree that it is likely that he's using Turbo C under MS-DOS or
MS-Windows, but the C Standard does not guarantee this.

The C standard is not relevant at this point.
If that is the case, then he would be better off seeking advice in a
newsgroup dedicated to discussing his implementation.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Sep 7 '07 #19
Philip Potter said:
Richard Heathfield wrote:
>Chris Hills said:
>>In article <ln************ @nuthaus.mib.or g>, Keith Thompson
<ks***@mib.or gwrites
void main()
Wrong. main returns int.
Not always but if we are assuming "conio.h" then it should

Whether main may return something other than int does *not* depend on
the availability or otherwise of a header named <conio.h>, but on
whether the implementation is a hosted C90 implementation.

Even on a freestanding implementation main may be required to return
int.
Very true. Nevertheless, whether it *may* (i.e. is allowed to) return
something other than int (and still remain a correct program) depends
on the criteria I gave.
Are hosted implementations free to accept void main(void) if they
wish?
Yes. Implementations , hosted or otherwise, have always been free to
provide extensions which do not break correct programs. Furthermore,
they have always been free to accept incorrect programs.
Obviously they must still accept int main(void).
Indeed.

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Sep 7 '07 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3382
by: JBiagio | last post by:
Hello All, I am attempting to learn a bit about the GDI+ transforms and charting data and I feel like I'm getting a handle on how the transforms work. My chart object has a large "canvas" bitmap that all data is scaled to and rendered on, and I display a smaller "window" of the canvas that the user can page through left and right. I've been able to scale my data (for the purposes of this discussion, x values are 0 - 2PI and y values...
14
3105
by: Pmb | last post by:
At the moment I'm using Borland's C++ (http://www.borland.com/products/downloads/download_cbuilder.html#) I want to be able to take an array of points and plot them on the screen. Is there a way to do this? E.g. I want to be able to graph a function. At this point I'm not up to a level in C++ where I want to start learning Visual C++ so I don't want to go that route. Thanks
7
8745
by: Marc Pelletier | last post by:
Hello all, I have a class which includes a method to create a chart. I want to be able to call this method from asp.net code as well as windows application code, so I have sketched it out as returning a bitmap instance. In my asp.net code I think I should call this method to return a bitmap and then somehow stream it using the response object to the Webcontrols.image. Is that right? The image object is on a page with a number of...
0
1056
by: RamyaKarthik | last post by:
pls give some guide lines for developing project for online survey usin c++
1
1403
by: Ringo | last post by:
I need some help. I have an app that talks to a sonar board via the serial port. In my sp_DataReceived I gather all the data and put it into arrays. Then I want to draw the data in a pictureBox. I wrote a function called Draw_sonar2 that does all the drawing. It usually works but sometimes crashes saying the graphics object is already in use. After digging I saw that I should be doing the Drawing in the PB.paint, not a seperate function....
11
6739
by: Slickuser | last post by:
I have this function that will fill the ellipse every 10 seconds with specific x,y,w,h. Now I want do the the reverse, to clear the ellipse with given x,y using Timer at every 30s. Or I have put these (x,y,w,h) to an array? Later go back the array and fill ellipse with the same color as background? Is there an easy way?
6
4147
by: jt | last post by:
i think i was not clear in my quesiton. my question actually was how to store a graphics image generated in C. Eg. #include<graphics.h> void main() { int gm,gd=DETECT; initgraph(&gd,&gm,""); rectangle(50,50,200,300);
9
2667
by: DaveL | last post by:
hello I have a Bit map 1367 wide 32 high this bitmap contains like 40 separate Images 32x32 I tell it the id*32 to get the approiate Image from the source Bitmap When i CreateGraphics() From the Standard CreateGraphics() function the code below works
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10607
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10359
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10104
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7645
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5541
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3843
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.