求给一个C++程序注释!!程序代码如下:谢谢

\u6c42c++\u7a0b\u5e8f\u6bcf\u884c\u4ee3\u7801\u6ce8\u91ca\uff1f

\u54ce\u5440\uff0c\u8fd9\u8981\u6ce8\u91ca\uff0c\u8fd8\u8981\u6572\u4ee3\u7801\uff0c\u80fd\u4e0d\u80fd\u76f4\u63a5\u53d1\u4ee3\u7801\uff1f

#include

// Global variable

HINSTANCE hinst;

// Function prototypes.

int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int);
InitApplication(HINSTANCE);
InitInstance(HINSTANCE, int);
LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);

// Application entry point.

int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;

if (!InitApplication(hinstance))
return FALSE;

if (!InitInstance(hinstance, nCmdShow))
return FALSE;

BOOL fGotMessage;
while ((fGotMessage = GetMessage(&msg, (HWND) NULL, 0, 0)) != 0 && fGotMessage != -1)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
UNREFERENCED_PARAMETER(lpCmdLine);
}

BOOL InitApplication(HINSTANCE hinstance)
{
WNDCLASSEX wcx;

// Fill in the window class structure with parameters
// that describe the main window.

wcx.cbSize = sizeof(wcx); // size of structure
wcx.style = CS_HREDRAW |
CS_VREDRAW; // redraw if size changes
wcx.lpfnWndProc = MainWndProc; // points to window procedure
wcx.cbClsExtra = 0; // no extra class memory
wcx.cbWndExtra = 0; // no extra window memory
wcx.hInstance = hinstance; // handle to instance
wcx.hIcon = LoadIcon(NULL,
IDI_APPLICATION); // predefined app. icon
wcx.hCursor = LoadCursor(NULL,
IDC_ARROW); // predefined arrow
wcx.hbrBackground = GetStockObject(
WHITE_BRUSH); // white background brush
wcx.lpszMenuName = "MainMenu"; // name of menu resource
wcx.lpszClassName = "MainWClass"; // name of window class
wcx.hIconSm = LoadImage(hinstance, // small class icon
MAKEINTRESOURCE(5),
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
LR_DEFAULTCOLOR);

// Register the window class.

return RegisterClassEx(&wcx);
}

BOOL InitInstance(HINSTANCE hinstance, int nCmdShow)
{
HWND hwnd;

// Save the application-instance handle.

hinst = hinstance;

// Create the main window.

hwnd = CreateWindow(
"MainWClass", // name of window class
"Sample", // title-bar string
WS_OVERLAPPEDWINDOW, // top-level window
CW_USEDEFAULT, // default horizontal position
CW_USEDEFAULT, // default vertical position
CW_USEDEFAULT, // default width
CW_USEDEFAULT, // default height
(HWND) NULL, // no owner window
(HMENU) NULL, // use class menu
hinstance, // handle to application instance
(LPVOID) NULL); // no window-creation data

if (!hwnd)
return FALSE;

// Show the window and send a WM_PAINT message to the window
// procedure.

ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
return TRUE;

}
\u4ee5\u4e0a\u662fMSDN\u4e2d\u7684\u4f8b\u5b50\uff0c\u5f88\u8be6\u7ec6\u4e86\u3002

#include <iostream>
#include <vector>//vector头文件
#include <stack>
#include <algorithm>//常用算法头文件
using namespace std;

class street
{
public:
int s, t, pri;
};

vector<street>v[45];//在vector头文件中有声明

bool operator<(const street &a, const street &b)//重载<
{
return a.pri < b.pri;
}

stack<int>sta;//同ector

int n, size;

int du[45];

int pre[45];

void DFS(int k)
{
pre[k]=size++;

int a=v[k].size(), i;

for(i=0; i<a; i++)
{
if(pre[v[k][i].t] == 0)
{
DFS(v[k][i].t);
}
}
}

int lu[2000];

void work(int k)
{
int a=v[k].size(), i;

for(i=0; i<a; i++)
{
if(lu[v[k][i].pri] == 0)
{
lu[v[k][i].pri]=1;
work(v[k][i].t);
sta.push(v[k][i].pri);
}
}
}

int main()
{
int x0, i, flag;

int a, b, zhi;

street str;

while(1)
{

n=0;

memset(du, 0, sizeof(du));

memset(pre, 0, sizeof(pre));

scanf("%d%d", &a, &b);

if(a == 0 && b == 0) return 0;

n=max(n, a);
n=max(n, b);

scanf("%d", &zhi);

a--;
b--;

x0=min(a, b);

du[a]++;
du[b]++;

str.s=a;
str.t=b;
str.pri=zhi;

v[a].push_back(str);//ector自带函数,在v后加入一个元素

swap(str.s, str.t);//在algorithm中声明,交换s和t

v[b].push_back(str);

while(1)
{
scanf("%d%d", &a, &b);//不专业,改为cin>>a>>b;

if(a == 0 && b == 0) break;

n=max(n, a);
n=max(n, b);

scanf("%d", &zhi);//不专业

a--;
b--;

du[a]++;
du[b]++;

str.s=a;
str.t=b;
str.pri=zhi;

v[a].push_back(str);

swap(str.s, str.t);

v[b].push_back(str);
}

flag=1;

for(i=0; i<n; i++)
{
if(du[i]%2 == 1)
{
flag=0;
cout << "Round trip does not exist.\n";
break;
}
}

if(flag)
{
size=1;

DFS(x0);

if(size!=n+1) cout << "Round trip does not exist.\n";

else
{
memset(lu, 0, sizeof(lu));//在algorithm中声明

for(i=0; i<n; i++) sort(v[i].begin(), v[i].end());

work(x0);

cout << sta.top();
sta.pop();

while(!sta.empty())
{
cout << " " << sta.top();

sta.pop();
}

cout << endl;

}
}

for(i=0; i<n; i++) v[i].clear();

}

return 0;
}

1楼你不要搞笑好不好。。输C的输入
出。不专业然后给个C++的输入输出~~~

  • 璇峰府鎴戠粰涓嬮潰C绋嬪簭娣诲姞娉ㄩ噴,鐪嬩笉鎳
    绛旓細write_data(table1[i]);} write_com(0x80+0x40);//涓插彛鍐欏叆,鍔犱笂鍚庨潰鐨勫啓鍏ュ簲璇ユ槸涓涓閫氳鍗忚 write_data('H');write_data(':');write_data(' ');write_data(0x30+8);write_data(0x30+5);write_data(' ');write_data('C');write_data(' ');write_data('L');write_data('...
  • 楂樻墜浠府鎴戠湅鐪c璇█绋嬪簭,璇风粰姣忚浠g爜鍜屽姛鑳娉ㄩ噴
    绛旓細浜.瀛﹀ソC璇█鐨勫洓绉绋嬪簭缁撴瀯 (1)椤哄簭缁撴瀯 椤哄簭缁撴瀯鐨勭▼搴忚璁℃槸鏈绠鍗曠殑,鍙鎸夌収瑙e喅闂鐨勯『搴忓啓鍑虹浉搴旂殑璇彞灏辫,瀹冪殑鎵ц椤哄簭鏄嚜涓婅屼笅,渚濇鎵ц銆 渚嬪;a = 3,b = 5,鐜颁氦鎹,b鐨勫,杩欎釜闂灏卞ソ鍍忎氦鎹袱涓澂瀛愭按,杩欏綋鐒惰鐢ㄥ埌绗笁涓澂瀛,鍋囧绗笁涓澂瀛愭槸c,閭d箞姝g‘鐨勭▼搴忎负: c = a; a...
  • 姹侰璇█绋嬪簭娉ㄩ噴銆,甯繖鐪嬬湅涓浼氱瓟杈
    绛旓細鍘绋嬪簭鏈夌偣闂锛屼笉鑳戒繚璇佺敓鎴愮殑涓瀹氭槸4浣嶇殑闅忔満鏁帮紝宸插府浣犳敼杩涘苟娉ㄩ噴濡備笅锛/*鐚滄暟娓告垙鏀硅繘鐗 dev-c++涓嬮獙璇侀氳繃*/ include<stdio.h> include<stdlib.h> include int main(){ int rdigit,rdigit1,num,num1,count,flag;int i,j,k,t,l[4]; /*j:鏁板瓧姝g‘鐨勪綅鏁 k:浣嶇疆姝g‘鐨勪綅鏁*/ /...
  • 甯繖鎶C璇█绋嬪簭娉ㄩ噴涓涓
    绛旓細甯繖鎶C璇█绋嬪簭娉ㄩ噴涓涓 #include<stdio.h>voidswap(int*x,int*y){intt;t=*x;*x=*y;*y=t;printf("x=%d,y=%d\n",*x,*y);return;}intmain(){inta,b;printf("pleaseenterdate(a,b):");scanf("%d,%d",&a,&b);prin... #include<stdio.h>void swap(int *x,int *y){ int t; t=...
  • 璇峰皢杩欎釜C婧愮▼搴娣诲姞涓浜娉ㄩ噴
    绛旓細int pingjun; //瀹氫箟涓涓鏁村瀷鍙橀噺pingjun,瀛樻斁骞冲潎鍒 } stu[50],temp; //瀹氫箟student鍨嬪彉閲弔emp,鍜屾暟缁剆tu int n=0; //瀛﹀憳涓暟 /* 鍑芥暟澹版槑 */ void tianjia();void shanchu();void charu();void chakan();void main() //涓诲嚱鏁 { int i; //鏁村瀷鍙橀噺 char c; //瀛楃鍙...
  • C璇█浠g爜姹傛敞閲鍙婅В閲
    绛旓細while(*t++=*s++)!=0);//鍦╰鎸囧悜鐨勫瓧绗︿覆灏鹃儴鎶妔鎸囧悜鐨勫瓧绗︿覆鎷兼帴涓娿傜涓娆★紝鎶妔瀛楃涓茬殑绗涓涓瀛楃璧嬬粰t锛岃浣忥紝杩欐椂鍊檛宸茬粡鏄寚鍚戜簡'\0'鐨勪綅缃紝鐒跺悗鎸囬拡s鍜屾寚閽坱閮藉姞涓锛屽垯浠栦滑鎸囧悜鐨勪綅缃兘浼氬悜鍚庣Щ鍔ㄤ竴涓瓧鑺傦紝鐩村埌鎸囬拡s鎸囧悜浜'\0'锛岃繖鏃跺欑粨鏉 }//鎵浠ヨ繖涓嚱鏁板叾瀹炲氨鏄瓧绗︿覆...
  • 缁欒繖娈绋嬪簭鍔犵偣娉ㄩ噴 C璇█
    绛旓細strcpy(person[1].name,"Wangjian");strcpy(person[2].name,"Zhaoming");for (i=0;i<3;i++) //杈撳叆涓変釜瀛︾敓鏁版嵁 { printf("Please input scores of %s:",person[i].name); //鎻愮ず鏂囧瓧 person[i].total=0; //鎬诲垎娓呴浂 for (j=0;j<8;j++) //杈撳叆涓涓瀛︾敓鐨勫緱鍒 { scanf("%f"...
  • C璇█绋嬪簭姹傛敞閲銆傛垜涓嶆噦C璇█,绋嬪簭鏄浜哄啓鐨,姹傚悇浣嶉珮鎵嬫敞閲婂苟璁╂垜...
    绛旓細if(_kbhit())//妫鏌ュ綋鍓嶆槸鍚︽湁閿洏杈撳叆锛岃嫢鏈夊垯杩斿洖涓涓闈0鍊硷紝鍚﹀垯杩斿洖0 { ch=_getch();if(ch>='1'&&ch<='8')//褰撳瓧绗﹀湪1鍒8鍐呮椂鎵ц涓嬮潰璇彞 { printf(" press %c, enter to continue...\n",ch);ch=0;break;} if(ch==27)break;//ch绛変簬27灏辫烦鍑哄惊鐜 } count=c...
  • 涓涓绠鍗曠殑c璇█绋嬪簭 姹傚姞娉ㄩ噴 鍙兘缁欏垎浠ョず鎰熻阿
    绛旓細int main(){ double a,b,c,s,area; // 瀹氫箟 double 鍨嬪彉閲 scanf("%f%f%f,&a,&b,&c"); // 杈撳叆 a b c 鐨勫 if(a+b>c && b+c>a && c+a>b) // 鍒ゆ柇鏄惁涓轰笁瑙掑舰(鍒ゆ嵁涓: 涓よ竟涔嬪拰澶т簬绗笁杈), 濡傛灉鏄, 鎵ц浠ヤ笅鎿嶄綔 { s=(a+b+c)/2;area=sqrt(s*(s-a)*(s-...
  • C璇█濡備綍娉ㄩ噴绋嬪簭?
    绛旓細C璇█鐨娉ㄩ噴鍒嗕负鍗曡娉ㄩ噴鍜屽琛屾敞閲婏細鍗曡娉ㄩ噴鐢 '//'寮曞锛屼竴鐩村埌琛屽熬閮藉睘浜庢敞閲婇儴鍒 渚嬪 //杩欓噷閮芥槸娉ㄩ噴 澶氳娉ㄩ噴锛岀敤鈥/*' 鍜 '*/'鍖呭す鐨勯儴鍒嗗寘鎷姌琛岄兘灞炰簬娉ㄩ噴閮ㄥ垎 渚嬪 /* 杩欓噷 閮芥槸 娉ㄩ噴*/
  • 扩展阅读:c++入门程序代码 ... 编程学习 ... c入门教程视频 ... 学习c# ... 自学编程入门教程 ... c#面试题 ... c++程序 ... c#开发游戏 ... c++新手代码大全 ...

    本站交流只代表网友个人观点,与本站立场无关
    欢迎反馈与建议,请联系电邮
    2024© 车视网