Tags » Cpp

Duterte seeks CPP explanation on Davao ambush, threatens to lift ceasefire


LUCENA CITY, Quezon – Following the ambush of government militiamen staged by New People’s Army (NPA) rebels on Wednesday, President Rodrigo Duterte on Thursday threatened to
http://bit.ly/2azsTBG

Write a program to calculate height of a tree.

#include <stdio.h>
#include <stdlib.h>

// Given a Binary serach tree.. Find its Diameter
typedef struct _sNode
{
long mValue;
struct _sNode * mLeftNode;
struct _sNode * mRightNode;
} Node;

void AddNode(Node ** pNode, Node * pNewNode);
void AddNode(Node ** pNode, int pValue);
long max(long pVal1, long pVal2);
long calclulateHeight(Node * pNode);

//Add a Node given the Root Node
void AddNode(Node ** pNode, Node * pNewNode)
{
if(*pNode == NULL)
{
*pNode = pNewNode;
return;
}
Node * lTempNode = *pNode;
if(pNewNode->mValue > lTempNode->mValue)
{
AddNode(&(lTempNode->mRightNode),pNewNode);
}
else
{
AddNode(&(lTempNode->mLeftNode),pNewNode);
}
}

//Create a new Node and add it to the tree
void AddNode(Node ** pNode, int pValue)
{
Node * lNode = (Node *) malloc(sizeof(Node));
lNode->mLeftNode= NULL;
lNode->mRightNode = NULL;
lNode->mValue = pValue;
if(*pNode == NULL)
{
*pNode = lNode;
}
else
{
AddNode(pNode, lNode);
}
}

//return max of two numbers
long max(long pVal1, long pVal2)
{
return (pVal1 > pVal2) ? 108 more words
CPP

Change of type alignment and the consequences

When porting software one of the task a developer faces is to change types’ sizes and rules of their alignments.

Once my attention was attracted by a message in RSDN forum: 463 more words

Programming

How to not shoot yourself in the foot when working with serialization

Despite the fact that it’s quite easy and comfortable to use the serialization mechanism in C#, there are some points that are worth taking note of. 3,637 more words

Programming

Source code of WPF samples by Microsoft got checked

Upon Windows Vista release, the company introduced a new subsystem for rendering user interfaces in Windows-based applications – Windows Presentation Foundation (WPF). This graphic subsystem is a part of the .NET Framework, starting with version 3.0. 3,635 more words

Programming

HEAP offers help for elderly residents

Cleveland has experienced a milder than normal winter, and the summer has come in blazing. Over the last month, we experienced several days where the temperature reached into the nineties. 336 more words

Cleveland Public Power

Problems of detecting 64-bit errors

There are various methods of detecting errors in program code. Let’s have a look at the most popular ones and see how efficient they are in finding 64-bit errors. 1,367 more words

Programming