Is this code correct? Please explain.
class Test
{
public:
int *i; <!--- Bobi: I think the star should be with the int -->
Test()
{
i= new int;
}
| public class PalindromeChecker { | |
| public static void main(String[] args) { | |
| String[] sWordsToCheck = new String[] { | |
| "gatemannametag", //p | |
| "abcdefghijklmnopqrtuvwxyz", // not p | |
| "aaaaa1aaaaa", //p | |
| "aaaaa12aaaaa", // not p | |
| }; | |
| for(int i=0; i<sWordsToCheck.length; ++i) { |
| class Timer | |
| def initialize | |
| ObjectSpace.define_finalizer(self, | |
| self.method(:finalize).to_proc) | |
| @start = Time.new | |
| end | |
| def finalize(id) | |
| p "Time: #{Time.now.to_f - @start.to_f} seconds" |
| function calcAge(year, month, day) { | |
| const now = new Date(); | |
| let age = now.getFullYear() - year; | |
| const mdif = now.getMonth() - month + 1; // jan is 0 in getMonth | |
| if (mdif < 0) { | |
| // not birthday yet | |
| --age; | |
| } | |
| else if (mdif === 0) { | |
| // maybe birthday? |
| #include <iostream> | |
| #include <cassert> | |
| #include <cstring> | |
| #include "nmath.h" | |
| using namespace std; | |
| typedef matrix_nxnt<2, float> matrix2x2; | |
| typedef vector_nt<3, float> vector3; | |
| typedef vector_nt<4, float> vector4; |
Is this code correct? Please explain.
class Test
{
public:
int *i; <!--- Bobi: I think the star should be with the int -->
Test()
{
i= new int;
}
| template <typename A, typename B> | |
| class myclass | |
| {}; | |
| template <typename T> | |
| struct is_myclass | |
| { | |
| struct yes { char c; }; | |
| struct no { char c[2]; }; |
| class Timer | |
| def initialize | |
| ObjectSpace.define_finalizer(self, | |
| self.method(:finalize).to_proc) | |
| @start = Time.new | |
| end | |
| def finalize(id) | |
| p "Time: #{Time.now.to_f - @start.to_f} seconds" |
| # c2md - v1.0 - public domain | |
| # authored in 2016 by Borislav Stanimirov | |
| # Used to generate dox files from cpp files | |
| if ARGV.length == 0 || ARGV[0] == '--help' || ARGV[0] == '-?' | |
| puts 'c2md' | |
| puts 'Generate markdown doc from a C-like language' | |
| puts | |
| puts 'Usage:' |
| template <typename T> | |
| struct fast_static | |
| { | |
| // call globally to ensure the constructor is called | |
| static T& slow_get() | |
| { | |
| static T t; | |
| return t; | |
| } |