Заданы числа A и t. Используя средства стандартного ввода-вывода, изобразить на экране график функции y=A*exp(-x/t).
Код:
#include <stdio.h>
#include <graphics.h>
#include <math.h>
#include <conio.h>
void main()
{
const a=50,b=200,k=50;
const float xmin=0, xmax=2*3.1415;
float x,y, h=0.01,t;
int xe,ye,w,A;
clrscr();
printf("введите A и t\n");
scanf("%f%f", &A,&t);
w=(xmax-xmin)*k;
line(a-10,b,a+w,b);
line(a,0,a,2*b);
for (x=xmin;x<xmax;x+=h)
{
y=A*exp(-x/t);
xe=a+k*x;
ye=b-k*y;
putpixel(xe,ye,12);
}
getch();
}
Журнал компиляции
Êîìïèëÿòîð: Default compiler
Âûïîëíåíèå gcc.exe...
gcc.exe "C:\Users\Ïàâåë\Documents\ñï\labhz.c" -o "C:\Users\Ïàâåë\Documents\ñï\labhz.exe" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32 C:\Dev-Cpp\lib\libwinmm.a
In file included from C:\Users\Ïàâåë\Documents\ñï\labhz.c:2:
C:/Dev-Cpp/include/graphics.h:30:59: sstream: No such file or directory
In file included from C:\Users\Ïàâåë\Documents\ñï\labhz.c:2:
C:/Dev-Cpp/include/graphics.h:224: error: syntax error before '*' token
C:/Dev-Cpp/include/graphics.h:228: error: syntax error before '*' token
C:/Dev-Cpp/include/graphics.h:229: error: syntax error before '*' token
C:/Dev-Cpp/include/graphics.h:235: error: syntax error before "getrefreshingbgi"
C:/Dev-Cpp/include/graphics.h:235: warning: data definition has no type or storage class
C:/Dev-Cpp/include/graphics.h:239: error: syntax error before '*' token
C:/Dev-Cpp/include/graphics.h:251: error: syntax error before "value"
C:/Dev-Cpp/include/graphics.h:256: error: syntax error before '=' token
C:/Dev-Cpp/include/graphics.h:269: error: syntax error before '=' token
C:/Dev-Cpp/include/graphics.h:278: error: syntax error before '=' token
C:/Dev-Cpp/include/graphics.h:300: error: syntax error before '=' token
C:/Dev-Cpp/include/graphics.h:306: error: syntax error before '=' token
C:/Dev-Cpp/include/graphics.h:310: error: syntax error before '=' token
C:/Dev-Cpp/include/graphics.h:324: error: syntax error before ':' token
C:/Dev-Cpp/include/graphics.h:325: error: syntax error before ':' token
C:/Dev-Cpp/include/graphics.h:326: error: syntax error before "std"
C:/Dev-Cpp/include/graphics.h:331: error: syntax error before '&' token
C:/Dev-Cpp/include/graphics.h:332: error: syntax error before "ismouseclick"
C:/Dev-Cpp/include/graphics.h:332: warning: data definition has no type or storage class
C:/Dev-Cpp/include/graphics.h:333: error: syntax error before "isresizeevent"
C:/Dev-Cpp/include/graphics.h:333: warning: data definition has no type or storage class
C:/Dev-Cpp/include/graphics.h:337: error: syntax error before "bool"
C:/Dev-Cpp/include/graphics.h:340: error: syntax error before '*' token
C:/Dev-Cpp/include/graphics.h:340: warning: data definition has no type or storage class
C:/Dev-Cpp/include/graphics.h:341: error: syntax error before '*' token
C:/Dev-Cpp/include/graphics.h:343: error: syntax error before '*' token
C:\Users\Ïàâåë\Documents\ñï\labhz.c: In function `main':
C:\Users\Ïàâåë\Documents\ñï\labhz.c:6: warning: return type of 'main' is not `int'
Âûïîëíåíèå çàâåðøåíî