测试.cpp

来自「本人参加ACM竞赛使用的一些算法模板」· C++ 代码 · 共 100 行

CPP
100
字号
/*SOURCES=$(patsubst %.cpp,%.o,$(wildcard *.cpp))
all:$(SOURCES)
$(SOURCES):%.o:%.cpp
	g++ $< -g -o $@
*/
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include <cctype>
#include <cstring>
#include <string>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
void io_test(){
	int a, b;
	while (cin >> a >> b){
		cout << a + b << endl;
	}
	while (scanf("%d %d", &a, &b) == 2){
		printf("%d\n", a + b);
	}
	cout.setf(ios::fixed);
	cout << setprecision(5) << -0.00 << endl;
	printf("%.2lf\n", -0.000);
	string line;
	char str[128];
	while (getline(cin, line) ){
		cout << line << endl;
	}
	while (gets(str) ){
		printf("%s\n", str);
	}
	getchar();
}



void dfs(int k){
	dfs(k + 1);
}
void error_test(){
	int a = 0;
	10 / a;
	
	int arr[10];
	cout << arr[30] << endl;
	
	dfs(0);
}


void display(int a[], int len){
	for (int i = 0; i < len; ++i){
		cout << i[a] << " ";
	}
	cout << endl;
}
void stl_test(){
	int arr[10];
	set <int> uset;
	for (int i = 0; i < 10; ++i){
		arr[i] = 10 - i;
		uset.insert(arr[i]);
	}
	cout << uset.size() << endl;
	sort (arr, arr + sizeof(arr) / sizeof(int) );
	display(arr, 10);
	make_heap(arr, arr + 10);
	display(arr, 10);
	next_permutation(arr, arr + 10);
	display(arr, 10);
	reverse(arr, arr + 10);
	display(arr, 10);
}
void string_test(){
	string str = "[hello] [word]";
	int op = str.find_first_of("[");
	cout << op << " " << str.substr(op, 4) << endl;
	op = str.find_first_of("[", 2);
	cout << op << " " << str.substr(op, 4) << endl;
}
void tle_test(){
	cout << "first" << endl;
	for (; ;);
	cout << "last" << endl;
}

int main(){
	
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?