c語言是沒有圖形函數(shù)庫的。。只有編譯器附屬的函數(shù)庫。如:turbo c 有g(shù)raphics.h函數(shù)庫。。。MS C有MFC
成都網(wǎng)絡(luò)公司-成都網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)公司十余年經(jīng)驗(yàn)成就非凡,專業(yè)從事成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè),成都網(wǎng)頁設(shè)計(jì),成都網(wǎng)頁制作,軟文營銷,廣告投放等。十余年來已成功提供全面的成都網(wǎng)站建設(shè)方案,打造行業(yè)特色的成都網(wǎng)站建設(shè)案例,建站熱線:13518219792,我們期待您的來電!
請采納答案,支持我一下。
#include iostream
#include windows.h
using namespace std;
/************************************************/
/*參數(shù)說明:
char *pszDestPath為需要遍歷的目標(biāo)路徑
/************************************************/
EnmuDirectory(char *pszDestPath, int sum)
{
//此結(jié)構(gòu)說明參MSDN
WIN32_FIND_DATA FindFileData;
//查找文件的句柄
HANDLE hListFile;
//絕對路徑,例:c:\windows\system32\cmd.exe
char szFullPath[MAX_PATH];
//相對路徑
char szFilePath[MAX_PATH];
//構(gòu)造相對路徑
wsprintf(szFilePath, "%s\\*", pszDestPath);
//查找第一個(gè)文件,獲得查找句柄,如果FindFirstFile返回INVALID_HANDLE_VALUE則返回
if((hListFile = FindFirstFile(szFilePath, FindFileData)) == INVALID_HANDLE_VALUE)
{
//查找文件錯(cuò)誤
return 1;
}
else
{
do
{
if( lstrcmp(FindFileData.cFileName, TEXT(".")) == 0 ||
lstrcmp(FindFileData.cFileName, TEXT("..")) == 0 )
{
continue;
}
//構(gòu)造全路徑
wsprintf(szFullPath, "%s\\%s", pszDestPath, FindFileData.cFileName);
//讀取文件屬性,如果不是文件夾
if(!(FindFileData.dwFileAttributes FILE_ATTRIBUTE_DIRECTORY))
{
char *pszFileType = NULL;
pszFileType = (FindFileData.cFileName[strlen(FindFileData.cFileName) - 3]);
if(!stricmp(pszFileType, "txt"))
{
coutFindFileData.cFileNameendl;
++sum;
}
}
//如果是文件夾,則遞歸調(diào)用EnmuDirectory函數(shù)
if(FindFileData.dwFileAttributes FILE_ATTRIBUTE_DIRECTORY)
{
EnmuDirectory(szFullPath, sum);
}
//循環(huán),查找下一個(gè)文件
}while(FindNextFile(hListFile, FindFileData));
}
//關(guān)閉句柄
FindClose(hListFile);
//清空結(jié)構(gòu)??捎锌蔁o的一句代碼。函數(shù)退出會(huì)自動(dòng)清空。
ZeroMemory(FindFileData, sizeof(FindFileData));
return 0;
}
int main()
{
int sum = 0;
EnmuDirectory("D:", sum);
#include?windows.h
LRESULT?CALLBACK?WndProc(HWND,?UINT,?WPARAM,?LPARAM);
int?WINAPI?WinMain(HINSTANCE?hInstance,?HINSTANCE?hPrevInstance,
PSTR?szCmdLine,?int?iCmdShow)
{
static?TCHAR?szAppName[]=TEXT("二次函數(shù)");
HWND?????????hwnd;
MSG??????????msg;
WNDCLASS?????wndclass;
wndclass.style=CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc=WndProc;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hInstance=hInstance;
wndclass.hIcon=LoadIcon(NULL,?IDI_APPLICATION);
wndclass.hCursor=LoadCursor(NULL,?IDC_ARROW);
wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName=NULL;
wndclass.lpszClassName=szAppName;
if?(!RegisterClass(wndclass))
{
MessageBox(NULL,?TEXT("Error"),
szAppName,?MB_ICONERROR);
return?0;
}
hwnd=CreateWindow(szAppName,?TEXT("二次函數(shù)"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,?CW_USEDEFAULT,
CW_USEDEFAULT,?CW_USEDEFAULT,
NULL,?NULL,?hInstance,?NULL);
ShowWindow(hwnd,?iCmdShow);
UpdateWindow(hwnd);
while?(GetMessage(msg,?NULL,?0,?0))
{
TranslateMessage(msg);
DispatchMessage(msg);
}
return?msg.wParam;
}
LRESULT?CALLBACK?WndProc(HWND?hwnd,?UINT?message,?WPARAM?wParam,?LPARAM?lParam)
{
static?int??cxClient,?cyClient;
const?static?int?n=1000;
HDC?????????hdc;
int?????????i;
PAINTSTRUCT?ps;
POINT???????apt[n];
switch?(message)
{
case?WM_SIZE:
cxClient=LOWORD(lParam);
cyClient=HIWORD(lParam);
return?0;
case?WM_PAINT:
hdc=BeginPaint(hwnd,?ps);
MoveToEx(hdc,?0,?cyClient/2,?NULL);
LineTo(hdc,?cxClient,?cyClient/2);
MoveToEx(hdc,?cxClient/2,?0,?NULL);
LineTo(hdc,?cxClient/2,?cyClient);
for?(i=0;?i??n;++i)
{
apt[i].x=cxClient/4+i; apt[i].y=cyClient-(cyClient/2-i)*(cyClient/2-i)/300-cyClient/2+100;
}
Polyline(hdc,?apt,?n);
return?0;
case?WM_DESTROY:
PostQuitMessage(0);
return?0;
}
return?DefWindowProc(hwnd,?message,?wParam,?lParam);
}
TC本來就有g(shù)raphics.h
所以要叫你下載graphics.h,graphics6.lib,graphics6u.lib這3個(gè)文件
這和TC沒關(guān)系,TC也用不上
你如果要求C++也不用下載了,有類,自己多了解了解
//?運(yùn)行該程序前,必須下載繪圖庫graphics.h
//?或者有問題聯(lián)系我
#include?graphics.h
#include?conio.h
#include?math.h
#define?N?1000
int?main(?)
{
initgraph(640,?480);//?打開圖形窗口
double?x[N],y[N];//每個(gè)點(diǎn)的x和y坐標(biāo)
int?i;
//1000個(gè)點(diǎn)是用三角函數(shù)來初始化的,也可以用離散數(shù)據(jù)
for(?i=0;i?N;i++)
{
x[i]=(3.14*2*i/N);
y[i]=sin(x[i]);
x[i]*=50;??????????????//調(diào)整到中間
y[i]*=100;?????????????//調(diào)整到中間
y[i]+=200;
}
while(!kbhit())
{
for(?i=0;i?N;i++)//第一段周期
{
putpixel(x[i],?y[i],?RED);
}
for(?i=0;i?N;i++)//第二段周期
{
putpixel(x[i]+314,?y[i],?RED);
}
}
return?0;
}