编译没有终端或SSH访问的c++
Compiling C++ without terminal or SSH access?
我在工作,我们已经完全锁定了电脑。我这里没有SSH终端。我有很多停机时间,我的意思是大量的停机时间,因为我的工作完成得很快。我在工作的同时在线学习,如果我能在学习的时候编译一些基本的c++代码,那就太好了。
任何想法?
我记得有一个代码粘贴网站,在那里你可以选择检查非常基本的c++代码的输出。那是什么网站?
必须有一些方法,我可以编译非常基本的c++代码,比如:
class Teapot {
int cups;
char* desc;
public:
Teapot();
Teapot(int c, const char* d);
Teapot(const Teapot&);
~Teapot();
Teapot& operator=(const Teapot&);
void operator=(int n);
void operator=(const char*);
void display() const;
};
// Teapot.cpp
#include <iostream>
#include <cstring>
using namespace std;
#include "Teapot.h"
Teapot::Teapot() {
cups = 0;
desc = NULL;
}
Teapot::Teapot(int c, const char* d) {
if (c > 0 && d != NULL) {
cups = c;
desc = new char[strlen(d) + 1];
strcpy(desc, d);
}
else {
desc = NULL;
*this = Teapot();
}
}
Teapot::Teapot(const Teapot& t) {
desc = NULL;
*this = t;
}
Teapot& Teapot::operator=(const Teapot& t) {
if (this != &t) {
delete [] desc;
cups = t.cups;
if (t.desc != NULL) {
desc = new char[strlen(t.desc) + 1];
strcpy(desc, t.desc);
}
else {
desc = NULL;
}
}
return *this;
}
Teapot::~Teapot() {
delete [] desc;
}
void Teapot::operator=(int n) {
if (desc != NULL && n > 0) cups = n;
}
void Teapot::operator=(const char* d) {
if (d != NULL) {
delete [] desc;
desc = new char[strlen(d) + 1];
strcpy(desc, d);
cups = 0;
}
}
void Teapot::display() const {
if (desc != NULL)
cout << cups << ' ' << desc << endl;
else
cout << "Empty" << endl;
}
网上有很多c++编译器,本文有一个很好的列表。虽然看起来Cameau
已经消失,LiveWorkSpace
已经处于只读模式一段时间了。godbolt
是列表中奇怪的一个,因为它确实显示了您的汇编输出,而不是运行代码。
相关文章:
- 通过方法访问结构
- 使用不带参数的函数访问结构元素
- 如果我只是不访问queue_front节点的子节点,而是将它们推到队列中呢?还是BFS吗
- 用于访问容器<T>数据成员的正确 API
- 访问者访问变体并返回不同类型时出错
- 尝试通过多个向量访问变量时,向量下标超出范围
- 无法访问嵌套类.类的使用无效
- 写入位置0x0000000C时发生访问冲突
- 我们可以访问一个不存在的联盟的成员吗
- C++从另一个类访问公共静态向量的正确方法是什么
- 我的简单if-else语句是如何无法访问的代码
- 从C++dll访问C#中的一行主要参数
- 概念TS检查忽略私有访问修饰符
- 访问被拒绝后,c++中的故障保护代码
- 在c++中访问int到类对象的映射时出错
- 我想访问std::unique_ptr中的一个特定元素
- 为什么示例代码访问IUnknown中已删除的内存
- C++:无法访问声明的受保护成员
- 通过指向指针数组的指针访问子类的属性
- 如何使用单独文件中的派生类访问友元函数对象