用户:
Esacpe_淸查看:7 回复:5 评论:7 创建时间:2022-05-04T16:12:38
相信大家在高科技的这个喵中,不可罢免地触碰到了一个与时俱进的东西——编程 而在本系列帖中,我——Anaxi——就要让大家认识一个编程种类—C++ 先看这块代码: #include<iostream> usingnamespacestd; intmain() { cout<<"HelloWorld!"; return0; } iostream [C++最基础的头文件] std [C++标准库] cout[输出] HOMEWORK 试着编写一个程序,输出"Chinaisimportant!!!"
#include<iostream>
using namespace std;
int main(){
cout << "HelloWorld"
return 0;
}行了吧
点赞0
评论
PlumSteven#include <windows.h>
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
switch(Message) {
case WM_DESTROY: {
PostQuitMessage(0);
break;
}
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
WNDCLASSEX wc;
HWND hwnd;
MSG msg;
memset(&wc,0,sizeof(wc));
wc.cbSize = sizeof(WNDCLASSEX);
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszClassName = "WindowClass";
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&wc)) {
MessageBox(NULL, "Window Registration Failed!","Error!",MB_ICONEXCLAMATION|MB_OK);
return 0;
}
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE,"WindowClass","Caption",WS_VISIBLE|WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
喵0,
480,
NULL,NULL,hInstance,NULL);
if(hwnd == NULL) {
MessageBox(NULL, "Window Creation Failed!","Error!",MB_ICONEXCLAMATION|MB_OK);
return 0;
}
while(GetMessage(&msg, NULL, 0, 0) > 0) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
送你个窗体满意了吧
点赞0
评论
Ezra__没讲清楚啊()
#include<iostream> //头文件,当前是调用输入输出流的
using namespace std; //使用标准命名空间,所有变量都要在这行代码之下声明(但这行代码没有用变量,所以可以不写)
int main(){ //主函数,所有代码都是要在这下面才能运行的
cout << "Hello World"; //使用输出流输出字符串“Hello World”
return 0;//除void函数外都要有返回值,虽然本地运行不会报错,但是在比赛中是会报错的
}
//int 整数声明,代码里的int是固定格式
//using 使用;namespace 命名空间;std 是standard的缩写,表示标准的意思点赞0
评论