May 8, 2014 at 3:14pm UTC
error in code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<graphics.h>
#include<iostream.h>
void main()
{
clrscr();
int x,y,r,c;
graph ();
srand(time(NULL));
while (!kbhit())
{
c=rand()%15+1;
x=rand()%getmaxx();
y=rand()%getmaxy();
r=1;
setfillstyle(1,c);
while (r<=100)
{
setcolor(c);
fillellipse(x,y,r,r);
r+=1;
delay(11);
}
}
closegraph();
}
Error:
Compiling screensaver.cpp:
Error screensaver.cpp 13:Function 'graph' should have prototype
help me!
Last edited on May 8, 2014 at 4:02pm UTC
May 8, 2014 at 3:25pm UTC
redundant #include<iostream.h>
put graph() 's definition (or prototype) above the main() function
Last edited on May 8, 2014 at 3:27pm UTC
May 8, 2014 at 3:54pm UTC
It does not show anything, and quickly returns to IDE
May 8, 2014 at 4:07pm UTC
Do you perhaps mean initgraph() ?
May 8, 2014 at 4:17pm UTC
Error screensaver.cpp 13:too few paremeters in call to 'initgraph(int far*,int far*,const far*)'
May 8, 2014 at 6:13pm UTC
Are you even bothering to look at the documentation for this stuff?
How do you know functions like fillellipse() exist if you don't have some kind of reference?
May 9, 2014 at 4:04am UTC
I tried this on another computer and it worked in windows xp