MAKEWORD()函数

本文介绍了C++编程中的基本概念,如内存管理(如动态数组和空指针)、数据结构(map),以及Windows编程中的Winsock库初始化和MAKEWORD宏。还涉及了网络安全协议SSH、Linux信号处理和抓包工具tcpdump。
摘要由CSDN通过智能技术生成
#include <iostream>
#include <map>
#include <iostream>
#include <windows.h>

using namespace std;
 
void myPrintf(void *a)
{
	cout<<"hello"<<endl;
} 
int main()
{
	
//	int *a=new int(10);//一个数 
//	cout<<*a<<endl;//10
//	delete a;
//	
//	int *arr=new int[10];//数组 
//	for(int i=0;i<10;i++)
//	{
//		arr[i]=i+1;
//	}
//	for(int i=0;i<10;i++)
//	{
//		cout<<arr[i]<<' ';
//	}
//	cout<<endl;
//	delete []arr;
//	
//	int num=10;
//	int *ptr=&num;
//	*ptr=20;
//	cout<<*ptr<<endl;//20
//	cout<<num<<endl;//20 
//	myPrintf(ptr);
//	
//	string str="hello,world,world";
//	cout<<str.find("world")<<endl;//6 
//	cout<<str.find(',')<<endl;//5 第一次出现的位置 
//	cout<<str.rfind("world")<<endl;//12 最后一次出现的位置
//	 
//
//	map<string,int> m;
//	m.insert(pair<string,int>("jkl",18)); 
//	m.insert(pair<string,int>("lyf",20)); 
//	m.insert(pair<string,int>("fbb",19)); 
//	cout<<m["jkl"]<<endl;//输出key对应的value 
//	cout<<m["lyf"]<<endl;
//	cout<<m["fbb"]<<endl;
	
	
	//vector可以动态扩展,数组是静态空间	  192
	//空指针使用NULL,不能使用0
	//oop Object Oriented Programming  面向对象编程 
	
	//SSH(Secure Shell,安全外壳)是一种网络安全协议
	//SSH协议通过对网络数据进行加密和验证,在不安全的网络环境中提供了安全的网络服务。
	
	//Linux下信号处理函数
	
	//linux抓包指令 tcpdump 
	
    //在Windows的网络编程中,需要先初始化Winsock库
	//而MAKEWORD函数就可以用于指定请求的Winsock版本	
	//包含在两个头文件<windows.h>  <winsock2.h>  
	//MAKEWORD函数是Windows编程中的一个宏。
	//该宏将两个字节组合成一个WORD类型的值,WORD类型通常为16位的无符号整数 
//	WSADATA wsaData;
//    int iResult;
//
//    // Initialize Winsock
//    //MAKEWORD(2,2)表示请求使用2.2版本的Winsock库
//    iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
//    if (iResult != 0) 
//	{
//    	printf("WSAStartup failed: %d\n", iResult);
//        return 1;
//    }
    BYTE bLow = 0x12;
    BYTE bHigh = 0x34;

	WORD wResult = MAKEWORD(bLow, bHigh);

	printf("The result is: %04X\n", wResult);//3412

	//linux下头文件<execinfo.h> 
    return 0;
}

  • 11
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值