1. 萌新啥也不会
#indluce《iosdream》
unsigned namesbace stb;
itn mian<>"
itn a,b'
cni<<a<<b'
cotu>>a+b'
rteurn 0 '
"
一个功(biān)能(yì)齐(cuò)全(wù)的A+B Problem
3. 为什么?
#include<iostream>
using namespace std;
int main(){
int a,b;
cin<<a<<b;
cout>>a+b;
return 0;
}
[Error] no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
2. 会一点,但不多
#include<iostream>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout<<a+b;
return 0;
}
4. 黄金时代
5. 黄金时代2
6. 关闭不了哦~~~~~~
#include<iostream>
#include<windows.h>
using namespace std;
void can_not_close(){
HWND hwnd=GetConsoleWindow();
HMENU hmenu=GetSystemMenu(hwnd,false);
RemoveMenu(hmenu,SC_CLOSE,MF_BYCOMMAND);
LONG style=GetWindowLong(hwnd, GWL_STYLE);
style&=~(WS_MINIMIZEBOX);
SetWindowLong(hwnd,GWL_STYLE,style);
SetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
ShowWindow(hwnd,SW_SHOWNORMAL);
DestroyMenu(hmenu);
ReleaseDC(hwnd,NULL);
}
int main(){
can_not_close();
}
7. 买Hello,World!还dfs
#include<iostream>
using namespace std;
int tree[16]={0,'H','e','r','l',',','l','!','l','o','W','o','d',0,0,0};
char ch;
void dfs(int n){
if(tree[n]!=0){
ch=tree[n];
cout<<ch;
}
if((n==15)||(n*2>15)||(n*2+1>15)){
return;
}
dfs(n*2);
dfs(n*2+1);
}
int main(){
dfs(1);
}
8. 论#define的重要性
#include<iostream>
#define a using
#define b namespace
#define c std
a b c;
#define d int
#define e main
#define h cin
#define i cout
#define q +
d e(){
d f,g;
h>>f>>g;
i<<f q g;
#define r return
r 0;
}