What do you want to save?
Add Code snippet
New code examples
-
C++ 2021-11-19 05:51:16
how to check type in c++
#include <typeinfo> #include <iostream> class someClass { }; int main(int argc, char* argv[]) { int a; someClass b; std::cout<<"a is of type: "<<typeid(a).name()<<std::endl; // Output 'a is of type... Add solution -
C++ 2021-11-18 14:41:15
increase the speed of cin and cout in c++
#include <iostream> int main(int argc, char **argv) { int parity = 0; int x; //you can use scanf , printf alternatively for speed std::ios::sync_with_stdio(false);// this increases the speed of i/o while (std::cin >> x) parity ^... Add solution -
C++ 2021-11-18 06:54:16
probability code c++
// this the c++ code for generating random numbers //pdf(x) = 1 if x>360 // = 0 if x<0 // = x/360 otherwise #include <iostream> #include <math.h> #include <stdlib.h> using namespace std; //This is a sample program t... Add solution -
C++ 2021-11-17 02:22:22
clock_gettime example
/* * This program calculates the time required to * execute the program specified as its first argument. * The time is printed in seconds, on standard out. */ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <ti... Add solution -
C 2021-11-13 08:50:16
c read file from command line
#include <stdio.h> int main(int argc, char **argv) { for (int i = 0; i < argc; ++i) { printf("argv[%d]: %s\n", i, argv[i]); } } /* [birryree@lilun c_code]$ ./a.out hello there argv[0]: ./a.out argv[1]: hello argv[2... Add solution -
C 2021-11-10 13:27:16
c read word from file
#include <stdio.h> #include <stdlib.h> int main(int argc, char * argv[]) { // This program reads a file from its arguments and prints a word by word. Additionally, it counts the words in the file. if (argc < 2) return 1; char * f... Add solution -
C++ 2021-11-06 21:06:11
how to choose struct's endianness cpp
#include <stdio.h> #include <stdint.h> //The line bellow does the trick: //__attribute__((packed, scalar_storage_order("big-endian"))) struct __attribute__((packed, scalar_storage_order("big-endian"))) mystruct { uint1... Add solution
Best helpers
Ranking is empty