[代码实例][C++]分析C程序源文件(不完善)

RAG 提示词工程最佳实践 虽然目前网络上关于提示工程的相关资料已经多如牛毛,然而 RAG (检索增强生成) 任务中提示工程如何进行的资料相对而言却较少。不少朋友之前也热烈的讨论过 RAG 场景下提示词的运用,因此 Zen 禅与计算机程序设计艺术 特别推出 RAG 任务下的提示词实践经验系列分享。RAG 是检索增强生成(Retrieval Augmented Generation)的简称,是当前最火热的企业级LLM应用方案。 阅读详情
#define TEMP	1	/*ABCDEFG*/			

#include <cstdlib>

#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <sstream>

using namespace std;

#if (TEMP==1)

// Macro definition
#define MACRO		0
#define MACROFUN	1
#define STRUCTURE	2
#define DATATYPE	3
#define VARIABLE	4
#define FUNCTION	5
#define STATICFUN	6
#define EXTERNFUN	7
#define TYPE_COUNT	8

// Macro function definition
#define MAX(x, y)	(if((x) >= (y)) ? (x) : (y))

// Structure definition
typedef struct MyStruct
{
	int field1;
	int field2;
} MyType;

// Variable definition
int myInteger1 = 123;
extern int myInteger2;

void fun(void)
{

}

static void staticFun(void)
{

}

extern void externFun(void)
{

}

#endif // (TEMP==1)

map<int, string>* fileLineMap = nullptr;

// 判断字符串1是不是以字符串2开始
bool startWith(string str1, string str2)
{
	return str1.compare(0, str2.length(), str2) == 0;
}

// 获取指定行序号(从0开始的)之前,并且紧临的注释
// 从后往前,逐行扫描“//”或被“/*”“*/”包含的行
string getComment(map<int, string>* codeLineMap, size_t index)
{
	string comment;
	size_t i = index - 1;
	bool isCommentInner = false;
	bool isCommentEnd = false;
	size_t pos;

	do
	{
		if ((*codeLineMap)[i].find_first_not_of(" \n") == string::npos)
		{
			break;
		}

		while (!isCommentInner && (pos = (*codeLineMap)[i].find("//")) != string::npos)
		{
			i--;
		}

		if ((*codeLineMap)[i].find_first_not_of(" \n") == string::npos)
		{
			break;
		}

		while ((*codeLineMap)[i].find("*/") != string::npos)
		{
			isCommentInner = true;
			i--;

			do
			{
				if ((*codeLineMap)[i].find("/*") != string::npos)
				{
					isCommentInner = false;
				}
				i--;
			} while (isCommentInner);
		}
	} while ((!isCommentInner && (*codeLineMap)[i].find("//") != string::npos)
		|| (*codeLineMap)[i].find("*/") != string::npos);

	for (int j = i + 1; j < index; j++)
	{
		comment.append((*codeLineMap)[j]);
	}

	return comment;
}

// 获取宏定义
// 如果某一行以“#define ”开始,但并不包含“(”,则为宏定义
list<pair<string, string>>* getMacro(map<int, string>* codeLineMap)
{
	list<pair<string, string>>* macroList = new list<pair<string, string>>();

	for (map<int, string>::iterator itor = codeLineMap->begin(); itor != codeLineMap->end(); itor++)
	{
		if (startWith(itor->second, "#define ") && itor->second.find_first_of("(") == string::npos)
		{
			string name;
			for (size_t i = 8; i < itor->second.length(); i++)
			{
				if (itor->second[i] == ' ' || itor->second[i] == '\n')
				{
					break;
				}
				else
				{
					name.push_back(itor->second[i]);
				}
			}

			macroList->push_back(make_pair(name, getComment(fileLineMap, itor->first) + fileLineMap->at(itor->first)));
		}
	}

	return macroList;
}

// 获取宏函数定义
// 如果某一行以“#define ”开始,但并包含“(”,则为宏函数定义
list<pair<string, string>>* getMacroFunc(map<int, string>* codeLineMap)
{
	list<pair<string, string>>* macroFuncList = new list<pair<string, string>>();

	for (map<int, string>::iterator itor = codeLineMap->begin(); itor != codeLineMap->end(); itor++)
	{
		if (startWith(itor->second, "#define ") && itor->second.find_first_of("(") != string::npos)
		{
			string name;
			for (size_t i = 8; i < itor->second.length(); i++)
			{
				if (itor->second[i] == '(')
				{
					break;
				}
				else
				{
					name.push_back(itor->second[i]);
				}
			}

			macroFuncList->push_back(make_pair(name, getComment(fileLineMap, itor->first) + fileLineMap->at(itor->first)));
		}
	}

	return macroFuncList;
}

// 获取全局变量定义
// 对于某一行,需要排除宏(或宏函数)(以#define开始)、数据类型(以typedef struct开始)、函数(包含括号)
// 同时还要排除这一行在代码块中
// 排除这些情况,基本可认定这就是一个全局变量。
list<pair<string, string>>* getVariable(map<int, string>* codeLineMap)
{
	list<pair<string, string>>* variableList = new list<pair<string, string>>();

	int count = 0;
	bool isStringInner = false;
	for (map<int, string>::iterator itor = codeLineMap->begin(); itor != codeLineMap->end(); itor++)
	{
		if (itor->first == 325)
		{
			int kkk = 0;
			kkk++;
		}

		string line = itor->second;
		if (line.length() > 0)
		{
			line.erase(line.length() - 1, 1);
		}

		for (int i = 0; i < line.length(); i++)
		{
			if (line[i] == '\"' && !isStringInner)
			{
				isStringInner = true;
			}
			else if (line[i] == '\"' && isStringInner)
			{
				isStringInner = false;
			}
			if ((line[i] == '\'' && line[i + 1] == '{' && line[i + 2] == '\'')
				|| (line[i] == '\'' && line[i + 1] == '}' && line[i + 2] == '\''))
			{
				i += 2;
			}
			else if (line[i] == '{' && !isStringInner)
			{
				count++;
			}
			else if (line[i] == '}' && !isStringInner)
			{
				count--;
			}
		}


		if (!startWith(line, "#define ") && !startWith(line, "typedef struct")
			&& line.find("using ") == string::npos
			&& line.find_first_of(";") != string::npos && count == 0
			&& line.find_first_of("(") == string::npos && line.find_first_of(")") == string::npos
			&& line.find_first_of("{") == string::npos && line.find_first_of("}") == string::npos
			&& line.find("extern ") == string::npos)
		{
			string name;
			size_t pos;

			pos = line.find_first_of("=");
			if (pos != string::npos)
			{
				if (line[--pos] == ' ')
				{
					pos--;
				}
			}
			else
			{
				pos = line.find_first_of(";");
				pos--;
			}

			do
			{
				name.push_back(line[pos]);
			} while (line[--pos] != ' ');
			reverse(name.begin(), name.end());

			variableList->push_back(make_pair(name, getComment(fileLineMap, itor->first) + fileLineMap->at(itor->first)));
		}
	}

	return variableList;
}

// 获取全局变量定义
// 对于某一行,需要排除宏(或宏函数)(以#define开始)、数据类型(以typedef struct开始)
// 排除这些情况,同时满足包含括号,基本可认定这就是一个函数。
void getFunction(map<int, string>* codeLineMap, list<pair<string, string>>* functionList, list<pair<string, string>>* staticFunctionList, list<pair<string, string>>* externFunctionList)
{
	int count = 0;
	for (map<int, string>::iterator itor = codeLineMap->begin(); itor != codeLineMap->end();)
	{
		string line = itor->second;

		if (!startWith(line, "#define ") && !startWith(line, "typedef struct")
			&& line.find("using ") == string::npos && line.find("=") == string::npos && line.find(";") == string::npos
			&& line.find_first_of("(") != string::npos
			&& count == 0)
		{
			string name;
			size_t pos;

			pos = line.find_first_of("(");
			if (line[--pos] == ' ')
			{
				pos--;
			}

			do
			{
				name.push_back(line[pos]);
			} while (line[--pos] != ' ');
			reverse(name.begin(), name.end());

			bool hasBodyInner = false;
			string code;
			map<int, string>::iterator itor_temp;
			for (itor_temp = itor; itor_temp != codeLineMap->end(); itor_temp++)
			{
				for (int i = 0; i < itor_temp->second.length(); i++)
				{
					if ((itor_temp->second[i] == '\'' && itor_temp->second[i + 1] == '{' && itor_temp->second[i + 2] == '\'')
						|| (itor_temp->second[i] == '\'' && itor_temp->second[i + 1] == '}' && itor_temp->second[i + 2] == '\''))
					{
						i += 2;
					}
					else if (itor_temp->second[i] == '{')
					{
						count++;
						hasBodyInner = true;
					}
					else if (itor_temp->second[i] == '}')
					{
						count--;
					}
				}

				code.append(fileLineMap->at(itor_temp->first));

				if (hasBodyInner && count == 0)
				{
					break;
				}
			}

			if (line.find("extern ") == string::npos && line.find("static ") == string::npos)
			{
				functionList->push_back(make_pair(name, getComment(fileLineMap, itor->first) + code));
			}
			else if (line.find("static ") != string::npos)
			{
				staticFunctionList->push_back(make_pair(name, getComment(fileLineMap, itor->first) + code));
			}
			else if (line.find("extern ") != string::npos)
			{
				externFunctionList->push_back(make_pair(name, getComment(fileLineMap, itor->first) + code));
			}

			itor = itor_temp;
			if (itor->second[itor->second.length() - 1] == '\n')
			{
				itor++;
			}
		}

		itor++;
	}
}

// 获取宏定义
// 如果某一行以“typedef struct”开始,则为数据类型
list<pair<string, string>>* getDatatype(map<int, string>* codeLineMap)
{
	list<pair<string, string>>* datatypeList = new list<pair<string, string>>();

	int count = 0;
	for (map<int, string>::iterator itor = codeLineMap->begin(); itor != codeLineMap->end();)
	{
		string line = itor->second;

		if (startWith(line, "typedef struct")
			&& line.find("using ") == string::npos && line.find("=") == string::npos && line.find(";") == string::npos
			&& count == 0)
		{
			string name;
			bool hasBodyInner = false;
			string code;
			map<int, string>::iterator itor_temp;
			for (itor_temp = itor; itor_temp != codeLineMap->end(); itor_temp++)
			{
				for (int i = 0; i < itor_temp->second.length(); i++)
				{
					if (itor_temp->second[i] == '{')
					{
						count++;
						hasBodyInner = true;
					}
					else if (itor_temp->second[i] == '}')
					{
						count--;
					}
				}

				code.append(fileLineMap->at(itor_temp->first));

				if (hasBodyInner && count == 0)
				{
					size_t pos = itor_temp->second.find_last_of("}") + 1;
					while (itor_temp->second[pos] == ' ')
					{
						pos++;
					}
					for (size_t i = pos; i < itor_temp->second.length(); i++)
					{
						if (itor_temp->second[i] == ';' || itor_temp->second[i] == ' ' || itor_temp->second[i] == '\n')
						{
							break;
						}

						name.push_back(itor_temp->second[i]);
					}

					break;
				}
			}

			datatypeList->push_back(make_pair(name, getComment(fileLineMap, itor->first) + code));

			itor = itor_temp;
			if (itor->second[itor->second.length() - 1] == '\n')
			{
				itor++;
			}
		}

		itor++;
	}

	return datatypeList;
}

// 去除空白
void eraseWhite(map<int, string>* codeLineMap)
{
	for (map<int, string>::iterator itor = codeLineMap->begin(); itor != codeLineMap->end(); itor++)
	{
		size_t pos;

		// 替换制表符为空格
		while ((pos = itor->second.find_first_of("\t")) != string::npos)
		{
			itor->second.replace(pos, 1, " ");
		}

		// 合并两个连续的空格为一个空格
		while ((pos = itor->second.find("  ")) != string::npos)
		{
			itor->second.replace(pos, 2, " ");
		}

		// 去除开始的空格
		itor->second.erase(0, itor->second.find_first_not_of(" "));

		// 去除结尾的空格
		if (itor->second.length() >= 2 && itor->second[itor->second.length() - 2] == ' ')
		{
			itor->second.erase(itor->second.length() - 2, 1);
		}

		// 去除分号的空格
		if (itor->second.find(" ;") != string::npos)
		{
			itor->second.erase(itor->second.find(" ;"), 1);
		}
	}
}

// 去除注释
void eraseComment(map<int, string>* codeLineMap)
{
	bool isCommentInner = false;
	bool isStringInner = false;
	for (map<int, string>::iterator itor = codeLineMap->begin(); itor != codeLineMap->end(); itor++)
	{
		for (size_t i = 0; i < itor->second.length();)
		{
			if (itor->second[i] == '/' && i < itor->second.length() && itor->second[i + 1] == '*')
			{
				if (!isStringInner)
				{
					isCommentInner = true;
					itor->second.erase(i, 2);
				}
				else
				{
					i += 2;
				}
			}
			else if (itor->second[i] == '*' && i < itor->second.length() && itor->second[i + 1] == '/')
			{
				if (!isStringInner)
				{
					isCommentInner = false;
					itor->second.erase(i, 2);
				}
				else
				{
					i += 2;
				}
			}
			else if (isCommentInner)
			{
				itor->second.erase(i, 1);
			}
			else if (itor->second[i] == '\\' && i < itor->second.length() && itor->second[i + 1] == '\"')
			{
				i += 2;
			}
			else if (itor->second[i] == '\"')
			{
				isStringInner = !isStringInner;
				i++;
			}
			else if (itor->second[i] == '/' && i < itor->second.length() && itor->second[i + 1] == '/')
			{
				if (!isStringInner)
				{
					itor->second.erase(i, itor->second.length() - 1);
				}
				else
				{
					i += 2;
				}
			}
			else
			{
				i++;
			}
		}
	}
}

map<int, string>* dealWithCodeLineList(map<int, string>* fileLineMap)
{
	map<int, string>* codeLineMap = new map<int, string>();
	for (map<int, string>::iterator itor = fileLineMap->begin(); itor != fileLineMap->end(); itor++)
	{
		codeLineMap->insert(make_pair(itor->first, itor->second));
	}

	eraseComment(codeLineMap);
	eraseWhite(codeLineMap);

	return codeLineMap;
}

map<int, string>* readFile(string srcFileName)
{
	map<int, string>* fileLineMap = new map<int, string>();

	ifstream ifstream(srcFileName);
	ostringstream buf;
	char ch;
	int i = 0;
	while (ifstream.get(ch))
	{
		// 首先得排除BOM(EF BB BF)三个字节的情况
		if (ch == (char)0xEF || ch == (char)0xBB || ch == (char)0xBF)
			continue;

		if (ch != '\n')
		{
			buf.put(ch);
			continue;
		}

		buf.put('\n');
		fileLineMap->insert(make_pair(i++, buf.str()));
		buf.str("");
	}

	if (buf.str().length() >= 0)
	{
		fileLineMap->insert(make_pair(i, buf.str()));
	}

	return fileLineMap;
}

int main()
{
	try
	{
#if (TEMP==1)
		string srcFileName = "D:\\Project\\VisualStudio\\CPlusPlus\\SrcAnalysis\\SrcAnalysis\\SrcAnalysis.cpp";
		//string srcFileName = "D:\\Project\\VisualStudio\\CPlusPlus\\SrcAnalysis\\SrcAnalysis\\test_code.c";
		string outputFileName_1 = "D:\\Project\\VisualStudio\\CPlusPlus\\SrcAnalysis\\Debug\\output1.txt";
		string outputFileName_2 = "D:\\Project\\VisualStudio\\CPlusPlus\\SrcAnalysis\\Debug\\output2.txt";
#else
		string srcFileName;
		cin >> srcFileName;
		string outputFileName_1;
		string outputFileName_2;
		cin >> outputFileName_1;
		cin >> outputFileName_2;
#endif // (TEMP==1)

		fileLineMap = readFile(srcFileName);

		ofstream ofstream1(outputFileName_1);
		ofstream ofstream2(outputFileName_2);

		map<int, string>* codeLineMap = dealWithCodeLineList(fileLineMap);

		list<pair<string, string>>* macroList = getMacro(codeLineMap);
		cout << "***** Macro *****" << endl;
		ofstream1 << "***** Macro *****" << endl;
		for (list<pair<string, string>>::iterator itor = macroList->begin(); itor != macroList->end(); itor++)
		{
			cout << "[" << itor->first << "] => " << endl << itor->second << endl;
			ofstream1 << "[" << itor->first << "] => " << endl << itor->second << endl;
		}

		list<pair<string, string>>* macroFuncList = getMacroFunc(codeLineMap);
		cout << "***** Macro Function *****" << endl;
		ofstream1 << "***** Macro Function *****" << endl;
		for (list<pair<string, string>>::iterator itor = macroFuncList->begin(); itor != macroFuncList->end(); itor++)
		{
			cout << "[" << itor->first << "] => " << endl << itor->second << endl;
			ofstream1 << "[" << itor->first << "] => " << endl << itor->second << endl;
		}

		list<pair<string, string>>* variableList = getVariable(codeLineMap);
		cout << "***** Variable *****" << endl;
		ofstream1 << "***** Variable *****" << endl;
		for (list<pair<string, string>>::iterator itor = variableList->begin(); itor != variableList->end(); itor++)
		{
			cout << "[" << itor->first << "] => " << endl << itor->second << endl;
			ofstream1 << "[" << itor->first << "] => " << endl << itor->second << endl;
		}

		list<pair<string, string>>* datatypeList = getDatatype(codeLineMap);
		cout << "***** Datatype *****" << endl;
		ofstream1 << "***** Datatype *****" << endl;
		for (list<pair<string, string>>::iterator itor = datatypeList->begin(); itor != datatypeList->end(); itor++)
		{
			cout << "[" << itor->first << "] => " << endl << itor->second << endl;
			ofstream1 << "[" << itor->first << "] => " << endl << itor->second << endl;
		}

		list<pair<string, string>>* functionList = new list<pair<string, string>>();
		list<pair<string, string>>* staticFunctionList = new list<pair<string, string>>();
		list<pair<string, string>>* externFunctionList = new list<pair<string, string>>();
		getFunction(codeLineMap, functionList, staticFunctionList, externFunctionList);
		cout << "***** Static Function *****" << endl;
		ofstream2 << "***** Static Function *****" << endl;
		for (list<pair<string, string>>::reverse_iterator itor = staticFunctionList->rbegin(); itor != staticFunctionList->rend(); itor++)
		{
			cout << "[" << itor->first << "] => " << endl << itor->second << endl;
			ofstream2 << "[" << itor->first << "] => " << endl << itor->second << endl;
		}
		cout << "***** Extern Function *****" << endl;
		ofstream2 << "***** Extern Function *****" << endl;
		for (list<pair<string, string>>::reverse_iterator itor = externFunctionList->rbegin(); itor != externFunctionList->rend(); itor++)
		{
			cout << "[" << itor->first << "] => " << endl << itor->second << endl;
			ofstream2 << "[" << itor->first << "] => " << endl << itor->second << endl;
		}
		cout << "***** Function *****" << endl;
		ofstream2 << "***** Function *****" << endl;
		for (list<pair<string, string>>::reverse_iterator itor = functionList->rbegin(); itor != functionList->rend(); itor++)
		{
			cout << "[" << itor->first << "] => " << endl << itor->second << endl;
			ofstream2 << "[" << itor->first << "] => " << endl << itor->second << endl;
		}
	}
	catch (const std::exception& ex)
	{
		cerr << endl << "[ERROR] " << ex.what() << endl;
	}

	return EXIT_SUCCESS;
}
手把手教你学 GPU KMD--1.2:UMD、KMD 与 DDK 的协作关系(下)——权限提升与安全边界 本文探讨了UMD、KMD与DDK协作中的权限提升与安全边界问题。GPU作为强大DMA引擎,必须通过分层权限模型(用户态/内核态)隔离风险,KMD作为守门人对UMD请求进行严格校验。文章详细分析了权限提升路径、安全边界设计(GPU虚拟内存隔离、命令白名单、IOMMU强制隔离等),并列举历史漏洞案例说明安全边界的重要性。现代增强方案包括虚拟化与可信执行环境。核心安全原则是"永远不信任用户态数据",需对所有地址、命令、资源和DMA进行严格管控。 阅读详情

相关推荐

[多智能体强化学习] 王树森YouTube课程笔记

前言 近期在设计V2X资源分配任务下的状态空间和动作空间,可以说是一筹莫展,是自己菜,现在看来可能也是涉及到一些关于多智能体强化学习实现过程中过于细节的点,目前的知识储备还不够。因此打算用半周到一周的时间重电,希望之后能有进展。 本文内容来自于友人LX所推荐的油管教程,链接如下:多智能体强化学习,一共两节课40min左右。教程废话不多干货不少,老师的声音还好听,推荐直接去看原教程。 这里还要多一嘴,那就是对于强化学习来说,单主体和多主体的界限,在某种程度上来说是很模糊的,并不是场景中有多个主体需要..

观林望实的博客 3363

Java 源文件分析

要求 因为只是一个小程序,所以代码全部放在同一个包下 此博文文字内容较少,因为注释比较多,如果有问题可私信博主 效果展示 此程序会生成一个 result 文件夹及 it.txt 文件,分析的内容保存到此处 Utils 工具类 import java.io.File; import java.util.Scanner; public class Utils { // 显示菜单信息 public static void showMenu() { System.out.pr

qq_52354687的博客 3113

AIDC智算中心建设:资源池化核心技术解析

AI 应用的POD在运行的时候,通过池化运行时访问虚拟GPU、执行AI任务,池化运行时拦截对虚拟GPU的访问请求、转递给池化服务代理执行,池化服务代理通过向智算池化控制器查询虚拟GPU所对应的真实智算资源位置、规格,按查询结果分配智算资源、执行AI任务,如果真实的智算资源位于远程计算节点,则由本地池化服务代理将访问请求转递给远程计算节点上的池化服务代理处理,相关通信经由参数面网络。

u013891230的博客 2431

第一个C程序代码分析

项目结构如下: 一.代码分析 打开项目中的main.c文件(C程序的源文件拓展名为.c),可以发现它是第一个C程序中的唯一一个源文件,代码如下: 1 #include  2 3 int main( int argc, const char * argv[]) 4 { 5 6 // insert code here... 7printf( " Hello, World!

pb09013037的专栏 778

M1安装homebrew报错LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54解决方法

在mac系统中,使用homebrew可以很方便的管理包。但按照官网的说明执行命令时总是报错原因是这个资源访问有问题,那么我们可以直接使用国内的镜像。给大家推荐一个中国科学技术大学的镜像站点,里面有各种资源https言归正传,开始踩坑。......

qq_42427085的博客 1455

机器学习的学习准则(期望风险最小化、经验风险最小化、结构风险最小化)

要评价模型f(x, θ)的好坏,可通过期望风险R(θ)来衡量:求期望损失R(θ)不仅需要知道损失函数还需要知道真实分布,损失函数可以通过一定的准则计算得到,但是样本空间的真实分布是未知的。所以不能直接求R(θ)。期望风险R(θ)无法计算,给定一个训练集D =,我们可以计算经验风险,经验风险就是在训练集上的平均损失:为了解决过拟合问题,引入了参数正则化来限制模型的能力。使其不要过度的最小化经验风险。这种准则就是结构风险最小化准则

... 2223

C++探索之旅(2)

C++探索之旅(2) 1.概述 现在最流行的语言大概是python了吧,由于python在爬虫领域的大放光彩以及它的易学易用和丰富的库,导致现在似乎已经变成人人必学的编程语言。但是究其根本,大概python都算不得编程语言,它只是一种古老的批处理命令集合。而且我们国家在这次新冠病毒疫情之下暴露出很多信息化的问题,诸如医疗统计数据问题、人传人的路线等等,这些底层并且基础性的问题摆在人们面前。人们第...

qq_28640119的博客 508

【汽车ECU电控数据管理篇】A2L文件在ECU标定中的关键作用与实战解析

本文深入解析A2L文件在汽车ECU标定中的关键作用,详细介绍了其作为'数据字典'的核心功能与实战应用。通过剖析A2L文件的结构、关键标签及常见问题,帮助工程师高效管理电控数据,提升ECU标定效率与准确性。文章特别强调了ASAP2标准下的A2L文件在汽车电控系统中的重要性。

a3b4c5的博客 786

第六课 C++探索“程序”

在C++中关于“程序”的知识:头文件源文件、程序运行过程、宏、内联

m0_60892159的博客 130

基于 ESP32-CAM 与 TinyML 的食堂餐盘自动识别与营养分析终端

【代码】基于 ESP32-CAM 与 TinyML 的食堂餐盘自动识别与营养分析终端。

weixin_42300449的博客 165

Python 爬虫实战:豆瓣 / IMDB 电影数据抓取(评分 + 剧情 + 演员阵容结构化处理)

在数据为王的时代,电影数据是进行市场分析、推荐系统构建和学术研究的重要资源。豆瓣和 IMDB 作为国内外最具影响力的电影评分和资讯网站,包含了海量高质量的电影数据。本文将带领你从零开始,构建一个健壮的 Python 爬虫,用于抓取豆瓣和 IMDB 的电影信息,并将其中的非结构化数据(如剧情简介、演员列表)进行清洗和结构化处理,最终存储到便于分析的结构化文件(如 CSV)中。

yansideyucsdn的博客 953

如何看懂源代码--(分析源代码方法)

由于今日计划着要看Struts 开源框架的源代码        昨天看了一个小时稍微有点头绪,可是这个速度本人表示非常不满意,先去找了下资料, 觉得不错... 摘自(繁体中文Traditional Chinese):http://www.ithome.com.tw/itadm/article.php?c=47717 下文为经过Google翻译过的简体中文版: 我们在写程式时,有不少...

weixin_33691817的博客 3740

掌握 Unity 中的状态机:综合指南

最后,将拥有一个由状态机驱动的功能齐全的播放器控制器,可以集成到自己的项目中。此外,状态机有助于实现复杂的人工智能、玩家控制、动画系统等,从而形成更强大、更灵活的游戏架构。状态机是计算机科学和游戏开发中的一个基本概念,它通过定义一组有限的状态及其之间的转换来模拟实体的行为。你可以定义常见的状态行为,例如 Enter、Update 和 Exit 方法,确保整个状态机架构的一致性和连贯性。由于前面提到的状态类扩展了 BaseState 类,因此我们可以为具有不同状态的不同对象创建单独的类。

yolo模型训练找我,AI游戏合作找我 1451

1.深入理解C/C++中头文件(.h)与源文件(.c/.cpp)以及我们为什么需要.h头文件

1.深入理解C/C++中头文件(.h)与源文件(.c/.cpp)以及我们为什么需要.h头文件 本篇文章灵感来自于:https://www.cnblogs.com/laojie4321/archive/2012/03/30/2425015.html 本文章中所有表情包均来自互联网,如有侵权,劳请联系。 另外,转载请标明出处哦,语雀:https://www.yuque.com/yifeideshijie 上面的文章很清楚地解析了在整个项目编译过程中的过程,头文件(通常的.h文件)和源文...

qq_43746863的博客 8843

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

c/c++ 头文件(.h)、源文件(.cpp)书写及接口与实现分离实例

c++实验代码及学习笔记(二) 全新的代码和文字风格!有趣的算法题和实用基础知识!敬请关注~

duoluka的博客 1万+

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

【C/C++内功心法】剖析编译链接的过程,探究源文件是如何一步步变成可执行程序,提升C/C++内功

组成一个程序的每个源文件通过编译过程分别转换成目标代码(object code)。 每个目标文件由链接器(linker)捆绑在一起,形成一个单一而完整的可执行程序。 链接器同时也会引入标准C函数库中任何被该程序所用到的函数,而且它可以搜索程序员个人的程序库,将其需要的函数也链接到程序中。

这是一个非常有意思的博主 6686

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

.c,.cc和.cpp

.c是C语言源文件的后缀,.C是C++源文件的后缀名 c++源文件后缀名详细如下 VC里用cpp作后缀名, 在GCC里默认采用C、cc、cxx作为后缀名 .cpp, .h (VS file).cc, .h (GCC file) C中: 头文件后缀名:.h 源文件后缀名: .c C++中: 头文件后缀名:.h, .hpp, .hxx 源文件后缀名:.c...

nextthen的博客 1万+

结合编译过程,分析C++头文件和源文件的区别

头文件和源文件的区别 头文件和源文件在本质上没有任何区别。 只不过一般:后缀为 .h 的文件是头文件,内含函数声明、宏定义、结构体定义等内容。后缀为 .c 的文件是源文件,内含函数实现,变量定义等内容。而且是什么后缀也没有关系,只不过编译器会默认对某些后缀的文件采取某些动作。这样分开写成两个文件是一个良好的编程风格。 原文链接:https://blog.youkuaiyun.com/qq_30815237/article/details/88948632 ...

qq_42178122的博客 6274

【Cpp】C和C++混合编程

一、混合编程杂绪 1.1 为什么需要混合编程 Cpp是从C演变过来的,C有很多优秀成熟项目和库,没必要在C++中重写,C++程序可以直接调用调用 庞大项目划分后一部分适合用C(底层),一部分适合用C++(中间层、上层) 1.2 混合编程的支撑 编译型程序的编译过程:源文件->目标(库)文件->可执行程序->镜像文件 任何编程语言执行时都必须是可执行程序,所以都必须先被编译成...

baymaxly的博客 7731

Dev C++使用教程(使用Dev C++编写C语言程序)_dev c++怎么用

Dev C++使用教程(使用Dev C++编写C语言程序)_dev c++怎么用

xiangxue666的博客 3万+

什么是源文件?

在开发软件的过程中,我们需要将编写好的代码(Code)保存到一个文件中,这样代码才不会丢失,才能够被编译器找到,才能最终变成可执行文件。这种用来保存代码的文件就叫做源文件(Source File)。 我们将在《编译和链接》一节中讲解编译器的概念。 每种编程语言的源文件都有特定的后缀,以方便被编译器识别,被程序员理解。源文件后缀大都根据编程语言本身的名字来命名,例如: C语言源文...

点滴记忆 5753

C\C++能否在源文件中包含源文件?

一、能不能? 稍微了解一点C\C++的朋友都知道#include关键字 现在有两个文件:file1.c和file2.c,它们的内容如下: // file1.c #include <stdio.h> void function(){ printf("file1 : hello world!\n"); } //file2.c #include "file2.c" int main(){ function(); printf("file2 : hello world!\n"); return

weixin_43031408的博客 1963

C++ Basic 14: C++源文件(.cpp)和头文件(.h)该怎么写才规范?

这个问题在许多C++程序员看来会很搞笑,“这么简单的问题还用得着你废话!”。但是由于本人生性愚钝,学C++的时候,确实花了很久的时间都搞不明白,只是会写一个文件,但不会写一个工程。而用C++编写比较大型的项目时,文件的分割管理确实确实是非常必要的。下面就非常简洁明了地谈谈头文件(.h)和源文件(.cpp)应该怎么写。 目录 头文件(.h): 源文件(.cpp): 第二篇...

Techblog of HaoWANG 6825

C++ 头文件.h 和 源文件.cpp 以及多重定义(multiple definition)

前言 之前虽然学过C++,但是都是零零散散看的,很多特性,尤其是C++ 11的特性我都不知道。因此最近在看C++ primer,算是系统地过一遍C++吧。在差不多看完C++ primer之后,对C++有了更深的理解,我才发现C++真是一门很有魅力的语言。虽然控制底层的东西很繁琐,但是也给了程序员一个接触底层的机会。 在写书上的代码时,我又遇到了一个刚入门时反复遇到的问题:头文件(.h)和源文件(....

Johnsonjjj的博客 3622

关于C/C++ 的源文件(.cpp)为什么要包含自己的头文件(.h)的思考

C/C++源文件要包含自己的头文件。

sparks__fly的博客 2898

cpp 程序调用 c 程序(extern “C“ 的使用)

.cpp 文件调用 .c 文件中的函数

challenglistic的博客 2933
上一篇: [代码实例][C]Connect Four
下一篇: [代码实例][HTML][Bootstrap]动态进度条
cloudblaze
博客等级 码龄17年 81粉丝 125原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值