D
DeLiLlaH
hi all ;
-------------------------------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<graphics.h>
main()
{
int gd = DETECT, gm, kod, i,x,y,a,x1;
initgraph(&gd, &gm, "C:\Dev-Cpp\bin");
kod graphresult();
x=getmaxx();
y=getmaxy();
a=x/12; x1=10;
randomize();
line(0,0,0,y);
line(0,y,x,y);
for (i=0; i<6; i++)
{
setfillstyle(i,random(getmaxcolor()));
bar3d(x1,random(y)+20, x1+a, y-1,a/2,1);
x1=x1+a*2;
}
getch();
closegraph();
}
----------------------------------------------------------------------------------------------------------------------
or
------------------------------------------------------------------------------------------------------------------------
#include <stdio.h>
int main(void)
{
int i, j, mark[] = {7,6,9,4,7,7,5,10,8,6,5};
for ( i = 0; i < sizeof mark / sizeof *mark; ++i )
{
printf("%2d|", i + 1);
for ( j = 0; j < mark; ++j )
{
fputs(" ", stdout);
}
puts("*");
}
puts(" +----------------------");
puts(" 0 1 2 3 4 5 6 7 8 9 10");
return 0;
}
---------------------------------------------------------------------------------------------------------------
First one is a 3d bar graphics and second is a histogram graphic,
How can I do first or second graphics for the numbers that I'll enter
randomly ??
-------------------------------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<graphics.h>
main()
{
int gd = DETECT, gm, kod, i,x,y,a,x1;
initgraph(&gd, &gm, "C:\Dev-Cpp\bin");
kod graphresult();
x=getmaxx();
y=getmaxy();
a=x/12; x1=10;
randomize();
line(0,0,0,y);
line(0,y,x,y);
for (i=0; i<6; i++)
{
setfillstyle(i,random(getmaxcolor()));
bar3d(x1,random(y)+20, x1+a, y-1,a/2,1);
x1=x1+a*2;
}
getch();
closegraph();
}
----------------------------------------------------------------------------------------------------------------------
or
------------------------------------------------------------------------------------------------------------------------
#include <stdio.h>
int main(void)
{
int i, j, mark[] = {7,6,9,4,7,7,5,10,8,6,5};
for ( i = 0; i < sizeof mark / sizeof *mark; ++i )
{
printf("%2d|", i + 1);
for ( j = 0; j < mark; ++j )
{
fputs(" ", stdout);
}
puts("*");
}
puts(" +----------------------");
puts(" 0 1 2 3 4 5 6 7 8 9 10");
return 0;
}
---------------------------------------------------------------------------------------------------------------
First one is a 3d bar graphics and second is a histogram graphic,
How can I do first or second graphics for the numbers that I'll enter
randomly ??