| | |
Can anyone help me using <graphics.h>
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
Hi there ! How r u?
Ohh I really need your help great programmers ...
I am new for programming and I am trying to do things by myself but here I need your help :-|
I would like to draw something in C or C++ but I got no basic IDEA ...
For example any kinds of graphics I would like to draw but...
I searched internet but I couldn't find concrete answer please give me some data link where can I learn or give me some advise of yours please please ...
give me some examples how can I use graphics.h lib .
I tried to draw "sine wave" but I couldn't please help me with this ...
Thanks beforehand....
Ohh I really need your help great programmers ...
I am new for programming and I am trying to do things by myself but here I need your help :-|
I would like to draw something in C or C++ but I got no basic IDEA ...
For example any kinds of graphics I would like to draw but...
I searched internet but I couldn't find concrete answer please give me some data link where can I learn or give me some advise of yours please please ...
give me some examples how can I use graphics.h lib .
I tried to draw "sine wave" but I couldn't please help me with this ...
Thanks beforehand....
Sorry may be I made my question not clear....
I just tried to draw y=sin(x) function graph just or something like that y=x+1 or e.t.c.
can you give me some hints for beginning my programm...
for example:
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include "graphics.h"
#define ESC 0x1b
void main () {
srand(time(NULL));
int GraphDriver=0; GraphMode=0;
initgraph (&GraphDriver ,&GraphMode, "", 640,480);
char tempstring[80];
getch() ;
}
}
Please do help me with drawing this y = sin(x) graph......
Do forgive me If I make some misunderstanding ....
Thanks
I just tried to draw y=sin(x) function graph just or something like that y=x+1 or e.t.c.
can you give me some hints for beginning my programm...
for example:
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include "graphics.h"
#define ESC 0x1b
void main () {
srand(time(NULL));
int GraphDriver=0; GraphMode=0;
initgraph (&GraphDriver ,&GraphMode, "", 640,480);
char tempstring[80];
getch() ;
}
}
Please do help me with drawing this y = sin(x) graph......
Do forgive me If I make some misunderstanding ....
Thanks
There is a C++ code snippet right here on DaniWeb called "Add a little Graphics to your Console" at:
http://www.daniweb.com/code/snippet173.html
You could potentially draw short lines following the x,y coordinates of your sin(x) function.
Forget about the old graphics.h and Borland BGI DOS stuff, that was left in the 16 bit graveyard a long time ago!
http://www.daniweb.com/code/snippet173.html
You could potentially draw short lines following the x,y coordinates of your sin(x) function.
Forget about the old graphics.h and Borland BGI DOS stuff, that was left in the 16 bit graveyard a long time ago!
May 'the Google' be with you!
•
•
•
•
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include "graphics.h"
#define ESC 0x1b
void main () {
srand(time(NULL));
int GraphDriver=0; GraphMode=0;
initgraph (&GraphDriver ,&GraphMode, "", 640,480);
char tempstring[80];
getch() ;
}
}
): main should be declared as int main NOT void main.......GraphMode is undefined as the previous ; finishes the statement (change the previous ; to a , ) and also ESC and tempstring are not used! also do you not have to shut down the driver at the end? - and bear in mind main returns 0; :p
http://sales.carina-e.com
no www
no nonsense
coming soon to a pc near you! :cool:
no www
no nonsense
coming soon to a pc near you! :cool:
•
•
•
•
Originally Posted by vegaseat
There is a C++ code snippet right here on DaniWeb called "Add a little Graphics to your Console" at:
http://www.daniweb.com/code/snippet173.html
You could potentially draw short lines following the x,y coordinates of your sin(x) function.
Forget about the old graphics.h and Borland BGI DOS stuff, that was left in the 16 bit graveyard a long time ago!
Thanks for suggestion but you know I hardly understand that code and here I am going to show you the code which I began first here and this is only drawing of X and Y oxes and I have to go on drawing sin(x) function please give me your suggestion....
-------------------------------------------------------------------------
#include "stdafx.h"
#include <graphics.h>
#include <conio.h>
void main()
{
int gd=DETECT, gm;
initgraph(&gd,&gm,"");
int x,y, j=250 ;
setbkcolor(WHITE);
setcolor(LIGHTBLUE);
outtextxy(3,5," I am so stupid hyong I am so stupid sorry sorry !!! "); // output "line" text
x = getmaxx();
y = getmaxy();
x=j;
line(j,0,x,y);
x = getmaxx();
y = getmaxy();
y=j;
line(0,j,x,y);
/*void line(int x0, int y0, int x1, int y1)
{
POINT line[2];
line[0].x = x0;
line[0].y = y0;
line[1].x = x1;
line[1].y = y1;
drawpoly(2, (int*)&line);
}
*/
getch();
closegraph(); // escape graphic mode
}
Thanks very much ....
•
•
•
•
Originally Posted by free_eagle
#include "stdafx.h"
#include <graphics.h>
#include <conio.h>
void main()
{
int gd=DETECT, gm;
initgraph(&gd,&gm,"");
int x,y, j=250 ;
setbkcolor(WHITE);
setcolor(LIGHTBLUE);
outtextxy(3,5," I am so stupid hyong I am so stupid sorry sorry !!! "); // output "line" text
x = getmaxx();
y = getmaxy();
x=j;
line(j,0,x,y);
x = getmaxx();
y = getmaxy();
y=j;
line(0,j,x,y);
/*void line(int x0, int y0, int x1, int y1)
{
POINT line[2];
line[0].x = x0;
line[0].y = y0;
line[1].x = x1;
line[1].y = y1;
drawpoly(2, (int*)&line);
}
*/
getch();
closegraph(); // escape graphic mode
}
Thanks very much ....
"graphics.h is a very old library for doing graphics in DOS with Borland C++ 3.x.
It's not supported under Windows, and the compiler isn't supported either."
I guess you are using Microsoft VC++...
1000BhP says:
"main should be declared as int main NOT void main...."
I don't think you have read their posts...
![]() |
Similar Threads
- getting graphics into c++ (C++)
- News Story: Is this the fastest graphics card in the world? (*nix Hardware Configuration)
- Roblox seeks Game and Graphics Guru (Software Development Job Offers)
- Graphics T and L support (Monitors, Displays and Video Cards)
- News Story: Sapphire reveals the ultimate graphics card (*nix Hardware Configuration)
- News Story: Intel committed to open source graphics drivers (Linux Servers and Apache)
- graphics card (Monitors, Displays and Video Cards)
- recommendations 4 a 3D graphics prog? (Graphics and Multimedia)
Other Threads in the C++ Forum
- Previous Thread: c++ compilation error
- Next Thread: Self documentation
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy desktop developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker list loop looping loops map math memory multiple news node number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference rpg sorting string strings struct temperature template test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






