githubはオンラインコンパイル機能を開始しました。
https://new.qq.com/omn/20200507/20200507A0B7CB00.html
この見積もりは、コンピューターのパフォーマンスとネットワークが良好な場合にのみ利用できます。
検索後、一部のWebサイトでは、単一のソースファイルコードのコンパイルに便利なオンラインコンパイル機能がすでに提供されています。
コンパイラのないコンピュータでは、単一のファイルのコンパイルを引き続き使用できます。
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;
}