跳到正文

休闲·娱乐

C++ Simple IDE version 1.0.0

EthanSong约 3 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年5月1日
篇幅
约 3 分钟

版本

  1. v2当前
  2. v1

C++C++ SimpleSimple IDEIDE versionversion 1.0.01.0.0

The author of this code is EthanSong. All rights reserved(2023).

This code is a opensource code. The source is below.

C++
#include <string>
#include <iostream>
#include <io.h>
using namespace std;
#define STDOUT 1
int main()
{
	printf("Welcome to C++ simple IDE version 1.0.0.\n");
	printf("The author of this code is EthanSong. All rights reserved(2023).\n");
	printf("Please enter the route you want your file to save.\nNote: The route's seperate char must be / not \\.\n");
	string filename;
	getline(cin, filename);
	printf("Please enter the filename you want your file to be.\nNote: The filname must be in English and with no spaces.\n");
	string name;
	getline(cin, name);
	if (filename[filename.size() - 1] != '/')
	{
		filename += '/';
	}
	filename += name;
	string a = filename;
	filename += ".cpp";
	a += ".exe";
	int oldstdout = dup(STDOUT);
	FILE *f = freopen(filename.c_str(), "w", stdout);
	while (getline(cin, name) && name != "[exit]")
	{
		cout << name << endl;
	}
	fclose(f);
	freopen("CON", "w", stdout);
	dup2(oldstdout, STDOUT);
	name = "g++ ";
	name += filename;
	name += " -o ";
	name += a;
	system(name.c_str());
	system(a.c_str());
	system("pause");
	return 0;
}
原文