在线编译试玩

github推出了在线编译功能,

https://new.qq.com/omn/20200507/20200507A0B7CB00.html

这个估计要电脑性能和网络良好的情况下才用得起来。

搜了下,有一些网站已经提供了在线编译功能,对于单个源文件代码的编译来说,还是比较方便的

在没有编译器的电脑上,对单个文件的编译,还是可以使用的,

测试了下https://tool.lu/coderunner/

可以进行编译,还不错

#include <iostream>
#include <malloc.h>

using namespace std;

char gstr[] = "abcaababbabcabbacc";

struct Node {
	Node* next;
	int pos;
};

Node* table[26][26][26] = {0};

void addNode(Node* head, int pos)
{
	while (head->next != NULL)
	{
		head = head->next;
	}
	
	Node* newNode = (Node*) malloc(1 * sizeof(Node));
	newNode->next = NULL;
	newNode->pos = pos;
	
	head->next = newNode;
}

void init(int len, char* str)
{
	for (int i = 0; i < len - 2; i++)
	{
		Node* head = table[gstr[i] - 'a'][gstr[i+1] - 'a'][gstr[i+2] - 'a'];
		if (head == NULL)
		{
			head = (Node*) malloc(1 * sizeof(Node));
			head->next = NULL;
			head->pos = i;
		}
		else
		{
			addNode(head, i);
		}
	}
}

int change(char* src, char* dst)
{
	int ret = 0;
	int pos = 0;
	Node* head = table[src[0] - 'a'][src[1] - 'a'][src[2] - 'a'];
	while (head != NULL)
	{
		if (head->pos >= pos)
		{
			gstr[head->pos] = dst[0];
			gstr[head->pos+1] = dst[1];
			gstr[head->pos+2] = dst[2];
			
			pos = head->pos + 3;
			ret++;
		}
	}
	
	return ret;
}

int main() {
	cout << "hello https://tool.lu/" << endl;
	return 0;
}

猜你喜欢

转载自blog.csdn.net/aaajj/article/details/106751325
今日推荐