模块导入: import xxx, from xxx import xxxx 增加路径
import sys
sys.path.append(path)
#include <iostream> | |
using namespace std; | |
class CArray { | |
int size; //数组元素的个数 | |
int *ptr; //指向动态分配的数组 | |
public: | |
CArray(int s = 0); |
描述 | |
魔兽世界的西面是红魔军的司令部,东面是蓝魔军的司令部。两个司令部之间是依次排列的若干城市。 | |
红司令部,City 1,City 2,……,City n,蓝司令部 | |
两军的司令部都会制造武士。武士一共有 dragon 、ninja、iceman、lion、wolf 五种。每种武士都有编号、生命值、攻击力这三种属性。 | |
双方的武士编号都是从1开始计算。红方制造出来的第n个武士,编号就是n。同样,蓝方制造出来的第n个武士,编号也是n。 |
描述 | |
在一个学生信息处理程序中,要求实现一个代表学生的类,并且所有成员变量都应该是私有的。 | |
输入 | |
姓名,年龄,学号,第一学年平均成绩,第二学年平均成绩,第三学年平均成绩,第四学年平均成绩。 | |
其中姓名、学号为字符串,不含空格和逗号;年龄为正整数;成绩为非负整数。 |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
char a; | |
cin >> a; | |
for(int i =1; i<=3;i++){ | |
for (int j=1; j<4-i;j++) | |
cout << " "; |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
int a; | |
cin >> a; | |
cout << (char) a; | |
} |
#include<iostream> | |
#include<cstdlib> | |
using namespace std; | |
int gcd(int a, int b) | |
{ | |
// swap a and b | |
if (a<b) |
// A simple recursive function has two main parts: the base-case part, where it computes a vaue and terminates, | |
// and the recursive part, where it calls itself. | |
#include <iostream> | |
//Recursive factorial function | |
// | |
//#include<iostream> |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |