EDN Admin
Well-known member
Hi,
Im using Microsoft Visual C++ 2005 Express Edition to write my C applications (I hardly use C++).
Im trying to run the following code, but apprently not all the necessary headers are standard included with my version of Visual C++.
Can anyone please tell me how / where to get all necessary files to run this and similar codes and how to install them?
Thanks. <font color="#0000ff" size=2>
#include</font><font size=2> </font><font color="#800000" size=2><stdio.h> </font><font color="#0000ff" size=2>
#include</font><font size=2> </font><font color="#800000" size=2><graph.h> </font><font color="#0000ff" size=2>
#include</font><font size=2> </font><font color="#800000" size=2><conio.h> </font><font color="#0000ff" size=2>
#include</font><font size=2> </font><font color="#800000" size=2><math.h> </font><font color="#0000ff" size=2>
#define</font><font size=2> BASE 512 </font><font color="#0000ff" size=2>
#define</font><font size=2> START 0 </font><font color="#0000ff" size=2>
#define</font><font size=2> To 273 </font><font color="#0000ff" size=2>
#define</font><font size=2> B 3200 </font><font color="#0000ff" size=2>
#define</font><font size=2> Ro 2000 </font><font color="#0000ff" size=2>
void</font><font size=2> main(</font><font color="#0000ff" size=2>void</font><font size=2>)
{
</font><font color="#0000ff" size=2>int</font><font size=2> x, y, word;
</font><font color="#0000ff" size=2>double</font><font size=2> R, T;
</font><font color="#0000ff" size=2>unsigned</font><font size=2> </font><font color="#0000ff" size=2>int</font><font size=2> lower_bits, upper_bits, flag;
outp(BASE,2);
</font><font color="#0000ff" size=2>for</font><font size=2>(;
{
_setvideomode(_DEFAULTMODE);
_setvideomode(_HRES16COLOR);
_clearscreen(_GCLEARSCREEN);
_setbkcolor(_GRAY);
_moveto(0,199);
_lineto(639,199);
_moveto(0,199);
_lineto(0,0);
_settextcolor(3);
_settextposition(4,3);
_outtext(</font><font color="#800000" size=2>"Temperature(0-100) celsius"</font><font size=2>);
</font><font color="#0000ff" size=2>for</font><font size=2>(x = 0;x <= 639; x++)
{
outp(BASE+1,START);
</font><font color="#0000ff" size=2>do </font><font size=2>
{
flag = inp(BASE+3);
}
</font><font color="#0000ff" size=2>while</font><font size=2>(32 & flag);
lower_bits = inp(BASE+2);
upper_bits = inp(BASE+3);
word = ((15 & upper_bits) * 256) + lower_bits;
R = 1.0869 * word / Ro;
T = 1 / (log(R) / B + 0.003413) - To;
y = 2 * (100 - T);
_setcolor(14);
_moveto(x,y);
_lineto(x,y);
}
getch();
}
} </font>
View the full article
Im using Microsoft Visual C++ 2005 Express Edition to write my C applications (I hardly use C++).
Im trying to run the following code, but apprently not all the necessary headers are standard included with my version of Visual C++.
Can anyone please tell me how / where to get all necessary files to run this and similar codes and how to install them?
Thanks. <font color="#0000ff" size=2>
#include</font><font size=2> </font><font color="#800000" size=2><stdio.h> </font><font color="#0000ff" size=2>
#include</font><font size=2> </font><font color="#800000" size=2><graph.h> </font><font color="#0000ff" size=2>
#include</font><font size=2> </font><font color="#800000" size=2><conio.h> </font><font color="#0000ff" size=2>
#include</font><font size=2> </font><font color="#800000" size=2><math.h> </font><font color="#0000ff" size=2>
#define</font><font size=2> BASE 512 </font><font color="#0000ff" size=2>
#define</font><font size=2> START 0 </font><font color="#0000ff" size=2>
#define</font><font size=2> To 273 </font><font color="#0000ff" size=2>
#define</font><font size=2> B 3200 </font><font color="#0000ff" size=2>
#define</font><font size=2> Ro 2000 </font><font color="#0000ff" size=2>
void</font><font size=2> main(</font><font color="#0000ff" size=2>void</font><font size=2>)
{
</font><font color="#0000ff" size=2>int</font><font size=2> x, y, word;
</font><font color="#0000ff" size=2>double</font><font size=2> R, T;
</font><font color="#0000ff" size=2>unsigned</font><font size=2> </font><font color="#0000ff" size=2>int</font><font size=2> lower_bits, upper_bits, flag;
outp(BASE,2);
</font><font color="#0000ff" size=2>for</font><font size=2>(;
{
_setvideomode(_DEFAULTMODE);
_setvideomode(_HRES16COLOR);
_clearscreen(_GCLEARSCREEN);
_setbkcolor(_GRAY);
_moveto(0,199);
_lineto(639,199);
_moveto(0,199);
_lineto(0,0);
_settextcolor(3);
_settextposition(4,3);
_outtext(</font><font color="#800000" size=2>"Temperature(0-100) celsius"</font><font size=2>);
</font><font color="#0000ff" size=2>for</font><font size=2>(x = 0;x <= 639; x++)
{
outp(BASE+1,START);
</font><font color="#0000ff" size=2>do </font><font size=2>
{
flag = inp(BASE+3);
}
</font><font color="#0000ff" size=2>while</font><font size=2>(32 & flag);
lower_bits = inp(BASE+2);
upper_bits = inp(BASE+3);
word = ((15 & upper_bits) * 256) + lower_bits;
R = 1.0869 * word / Ro;
T = 1 / (log(R) / B + 0.003413) - To;
y = 2 * (100 - T);
_setcolor(14);
_moveto(x,y);
_lineto(x,y);
}
getch();
}
} </font>
View the full article