CPP-Snake
// server: https://schlangen.bytewerk.org/
#include <bits/stdc++.h>
using namespace std;
void log(string str, Api* api){
api->log(str.c_str());
}
bool step(Api* api) {
api->log(string("Hello C-String World"));
string str="Debug Value1: ";
str+= 3 + ", some more text";
log(string("some string") + 5.1);
log(string()+3);
}
ich mache das:
string logtxt = "bla" + to_string(irgendeine integer variable);
api->log(logtxt.c_str());
int main(){
vector<int> vec(10,20);
vec.push_back(200);
}
/* C-Arrays: Legacy DO NOT USE */
int main(){
int some_array[23] = {5,2,3};
some_array[103];
*(some_array + 3)
return 0;
}
void caller(){
int a = 23;
call_by_value(a);
call_by_adress(&a);
// a is now 24
call_by_reference(a);
// a is now 25
}
void call_by_value(int a){
a++;
}
void call_by_adress(int * a){
(*a)++;
}
void call_by_reference(int& a){
a++;
}
api.functions_name();
(*api).funktions_name();
api->funktions_name();
ist das da in Ordnung?
Ich habe so meine Probleme mit Pointer, vectoren in funktionen...
void add(vector<int> *clc, int pos, int add)
{
(*clc)[pos] += add;
}
https://schlangen.bytewerk.org/static/docs/doxygen_cpp/html/bot__api_8h_source.html
https://schlangen.bytewerk.org/static/docs/doxygen_cpp/html/ipc__format_8h_source.html
https://de.cppreference.com/w/cpp/container/set
https://de.cppreference.com/w/cpp/container/map