Ad
Code
Diff
  • bool Or  ( bool a, bool b ){ return a ? a : b; }
    bool And ( bool a, bool b ){ return a ? b : false; }
    bool Xor ( bool a, bool b ){ return And(a,b) ? false: Or(a,b); }
    • bool Or ( bool a, bool b ){ return a | b; }
    • bool Xor ( bool a, bool b ){ return a ^ b; }
    • bool And ( bool a, bool b ){ return a & b; }
    • bool Or ( bool a, bool b ){ return a ? a : b; }
    • bool And ( bool a, bool b ){ return a ? b : false; }
    • bool Xor ( bool a, bool b ){ return And(a,b) ? false: Or(a,b); }
Fundamentals
Code
Diff
  • #include <stdio.h>
    
    int helloCplusplus(){
      return !puts("Hello Cplusplus\n");
    }
    • #include <stdio.h>
    • int helloCplusplus(){
    • puts("Hello Cplusplus
    • ");
    • return 0;
    • return !puts("Hello Cplusplus
    • ");
    • }
Code
Diff
  • -[------->+<]>-.-[->+++++<]>++.+++++++..+++.[--->+<]>-----.+++[->++<]>+.-[------>+<]>.+.[--->+<]>----.---------.----.+++++++.
    • >++++++[<++++++++++++>-]<.>>++++++++++[<++++++++++>-]<+.+++++++..+++.>>++++[<++++++++>-]<.<<-.>--------------.+.++++++++++++++++.---------.----.+++++++.
    • -[------->+<]>-.-[->+++++<]>++.+++++++..+++.[--->+<]>-----.+++[->++<]>+.-[------>+<]>.+.[--->+<]>----.---------.----.+++++++.
Code
Diff
  • inline float multiply(float number1, float number2 )
    {
      float answer = 0;
       while( number2 > 0 )
       {
          answer += number1;
          number2--;  
        }
        return answer;
    }
    
    
    float squared(float number)
    {
       if( number < 0 ) number = -number;
    
      int decimal_positions = 0;
      while( number - int(number) > 0.1 )
      {
        number = multiply(number, 10);
        decimal_positions++;
      }
      
        float factor = number;
    
      if( decimal_positions > 0 ) {
      number = multiply(number,number);
       switch (decimal_positions){
       case 1: factor = 0.01; break;
       case 2: factor = 0.001; break;
       case 3: factor = 0.0001; break;
       case 4: factor = 0.00001;
       }}
       
       return multiply(factor,number);
       
    }
    
    • inline int multiply(int x, int y, int counter)
    • inline float multiply(float number1, float number2 )
    • {
    • if (y <= 0)
    • return 0;
    • if (y == 1)
    • return x;
    • if (y & 0x1)
    • return x + multiply(x, y - 1, 0);
    • if (counter + counter <= y)
    • return multiply(x + x, y >> 1, counter + counter);
    • else
    • return x + multiply(x, y - counter, 0);
    • float answer = 0;
    • while( number2 > 0 )
    • {
    • answer += number1;
    • number2--;
    • }
    • return answer;
    • }
    • int squared(int number)
    • float squared(float number)
    • {
    • return multiply(number, number, 0);
    • if( number < 0 ) number = -number;
    • int decimal_positions = 0;
    • while( number - int(number) > 0.1 )
    • {
    • number = multiply(number, 10);
    • decimal_positions++;
    • }
    • float factor = number;
    • if( decimal_positions > 0 ) {
    • number = multiply(number,number);
    • switch (decimal_positions){
    • case 1: factor = 0.01; break;
    • case 2: factor = 0.001; break;
    • case 3: factor = 0.0001; break;
    • case 4: factor = 0.00001;
    • }}
    • return multiply(factor,number);
    • }