¶
3-4 ..
하..
.. 한하,, 했 .. ..한 하..
..
한 하..
.. .
하 .. ?ㅎ
하..
.. 한하,, 했 .. ..한 하..
..
한 하..
.. .
하 .. ?ㅎ
.
(y 25 . 25 .. 하..ㅎㅎ)tab 함.
TAB_Y 1 해 .
tab 1 할, 하 해, 할 하, 1하 ..
!ㅎ(히 X..ㅎ)
(y 25 . 25 .. 하..ㅎㅎ)tab 함.
TAB_Y 1 해 .
tab 1 할, 하 해, 할 하, 1하 ..
!ㅎ(히 X..ㅎ)
파 하 .;
¶
~cpp
#include <iostream>
#include <windows.h>
using namespace std;
const int MIN_X=-5;
const int MAX_X=5;
const float TAB_X=1;
const float TAB_Y=0.5;
int banollim(float number)
{
//하 함
float temp_sosu=number-(int)number;
if (temp_sosu<=-0.5 || temp_sosu>=0.5)
++number;
return number;
}
void gotoxy(int x, int y)
{
COORD Pos = {x - 1, y - 1};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Pos);
}
float function_x_to_y(float x)
{
// 함
float y=x*x;
return y;
}
void make_image(int where_x, int where_y, float min_x, float max_x, float tab_x, float tab_y)
{
// 할 x표, y표, x, x, x, y
////화.
int max_y=0;
int min_y=function_x_to_y(min_x);
//y 함
for (register float x=min_x; x<=max_x; x+=tab_x)
{
if (max_y<function_x_to_y(x))
max_y=function_x_to_y(x);
else if (min_y>function_x_to_y(x))
min_y=function_x_to_y(x);
}
////x,y
for (register float x=min_x; x<=max_x; ++x)
{
gotoxy(banollim(x-min_x+1+where_x),(where_y+max_y*tab_y));
printf (".");
}
for (register float y=min_y; y<=max_y; ++y)
{
gotoxy(banollim(-min_x+1+where_x),(where_y-banollim(y)*tab_y+max_y*tab_y));
printf (".");
}
////
for (register float x=min_x; x<=max_x; x+=tab_x)
{
gotoxy(banollim(x-min_x+1+where_x),(where_y-banollim(function_x_to_y(x))*tab_y+max_y*tab_y));
printf ("*");//(%.1f,%.1f)",x,function_x_to_y(x));
}
}
void main()
{
system("CLS");
cout << "2함 .";
make_image( 10 , 5 , MIN_X, MAX_X,TAB_X,TAB_Y);
gotoxy(30,5);
cout << "x y";
for (register int i=0; i<MAX_X-MIN_X+1;i+=1)
{
gotoxy(30,i+6);
printf ("%3d -> %3.0f",i+MIN_X,function_x_to_y(i+MIN_X));
}
}










