run c/cpp or other language snippet code
-
c
-
code snippet
$ snippet c -e 'int a = 500;' -e 'a = rand();' -e 'printf("%d\n", a);' -i stdlib.h -p -------------------------------------------------- #include <stdlib.h> #include <stdio.h> int main(void) { int a = 500; a = rand(); printf("%d\n", a); return 0; } -------------------------------------------------- 1804289383
-
read from user
$ snippet c -r Please input your code, make sure your code correct. Enter @@CODEEND input. int main() { printf("Hello World!!\n"); } @@CODEEND Hello World!!
-
file
$ snippet c *.c Hello World!!
-
-
cxx
-
code snippet
$ snippet cpp -e 'int a{500};' -e 'std::random_device rd{};' -e 'std::uniform_int_distribution<int> dist(0, 100000);' -e 'a = dist(rd);' -e 'std::cout <<a << std::endl;' -p -i random -------------------------------------------------- #include <random> #include <iostream> int main(void) { int a{500}; std::random_device rd{}; std::uniform_int_distribution<int> dist(0, 100000); a = dist(rd); std::cout <<a << std::endl; return 0; } -------------------------------------------------- 81873
-
read from user
$ snippet cpp -r -p Please input your code, make sure your code correct. Enter @@CODEEND input. int main() { std::cout <<"Hello World" << std::endl; } @@CODEEND -------------------------------------------------- #include <iostream> int main() { std::cout <<"Hello World" << std::endl; } -------------------------------------------------- Hello World
-
file
$ snippet cpp *.cpp Hello World!!
-