1: int result= 2;
2: result = result<<2 +1;
3: std::cout << "Result is " << result << '\n';
4: return (0);
1: int result= 2;
2: result = result<<2 +1;
3: std::cout << "Result is " << result << '\n';
4: return (0);
1: int main()
2: {
3: float result;
4:
5: result = 1/3;
6:
7: std::cout << "Result is " << result << '\n';
8: std::cin>> result;
9: return (0);
10: }
Sonuç ??
1: #include <stdio.h>
2: #include <iostream>
3:
4: int first(void)
5: {
6: int i = 0;
7:
8: return (i++);
9: }
10: int second(void)
11: {
12: static int i = 0;
13: return(i++);
14: }
15:
16:
17: int main()
18: {
19: int counter;
20: for(counter = 0;counter <3 ;counter++)
21: {
22: printf("First %d \n", first());
23:
24: }
25: for(counter = 0;counter <3 ;counter++)
26: {
27: printf("Second %d \n", second());
28:
29: }
30: std::cin>>counter;
31: return (0);
32:
33: }
sonuçlar
first 0 0 0
second 0 1 2
şeklinde.C# da bir fonksiyon içine static değişken tanımlanamazken c++ da tanımlabiliyor ve değer atansa bile sadece ilk oluşturur ken kullanıyor
1: #include <iostream>
2:
3: void main()
4: {
5: std::cout<<"Hello World \n";
6: return (0);
7: }
You have a list full of custom class items and want to find according to one property.Ok the best way is lambda functions(Or Not?).Other than lambda functions you can use reflection and use some code like:
public NeuronList FindByProperty(string PropertyName, object Value)
{
try
{
NeuronList foundItems = new NeuronList();
foreach (NeuronBase item in List)
{
System.Type itemType = item.GetType();
PropertyInfo[] itemProperties = itemType.GetProperties();
foreach (PropertyInfo info in itemProperties)
{
if (info.Name == PropertyName)
{
object itemValue = info.GetValue(item, null);
if (Convert.ChangeType(itemValue, info.PropertyType).Equals(Value))
{
foundItems.Add(item);
}
}
}
}
return foundItems;
}
catch (Exception ex)
{
throw new Exception("Can not find property", ex);
}
}
Have written a basic ann app which can do anything known about neural networks and has a simple ui, of course it needs lots of improvements but to get the basic idea you can take a look.
I am assuming you have some idea about neural networks
BaseNeuron is my neuron class which derives from user control. Input Neuron Middle Neuron and Output Neurons are derived from Base Neuron .Input Neuron is the neurons where you apply input output neurons are as name implies output :).Every neuron can be connected to another by synaps.A synaps becomes more powerful as it transmit signals
NeuralNetwork is our network and contains two collections inputneurons and neurons(middle and output).NeuralNetwork stores the fired neurons you can find all fired neurons in our network in nth turn.
NeuralPort is the ports where you can make connections(input and output) to ann.
NeuronList is our List that hold neurons and enables us to find desired neuron by neuronNo
NetworkVisualiser is the gui that shows our neural network connections and fired neurons.
Network builder is obsolete now network build her own.
I am uploading a copy in google code under hyacinth.
I have been busy with artificial neural networks for some time so couldn’t post much.
NDepend is a static code analyzer it inspects your code and tells dependincies metrics code analysis. I found metrics very useful.It tell if you used boxing if your namings are wrong, if you used wrong access modifier, you have too many fields.You can also write your own queries it uses cql code query language very similar to sql, You can select methods which returns int.
http://www.ndepend.com/ is the web page.
Take a look
I added some missing things to hyacinth my jabber client.She can now encrypt messages .
Pollard’s rho algorithm is used to factor composite integers. Suppose you have 8633, 89 *97 are the factors.
Here is the code:
static void Main(string[] args)
{
Int64 a = p.PollardRho(12187823);
}
public Int64 customFunct(Int64 param, Int64 mod)//Custom number generator
{
return ((param * param + 1 )% mod);
}
public Int64 PollardRho(Int64 number)
{
Int64 a = 2, b = 2, tmp;//initail starting values
while(true)
{
a = customFunct(a,number);//get first number
b = customFunct(customFunct(b,number),number);//get second double run custom func
tmp = GCD(Math.Abs(b-a), number);// if a = b mod d(divisor one of the divisors of our number) then a-b is multiple of d and number is multiple of d
if (tmp > 1)
break;
}
return tmp;
}
public Int64 GCD(Int64 x, Int64 y)//Greatest Common Divisor
{
if (x == 0)//Find it? return
return y;
if (y == 0)//Find it? return
return x;
x = x % y;// take the mod of the large val to small one if the order is wrong in the next recursive loop it will be correct
return GCD(y, x);//Parameters changed place
}
I put comments on the code and included usage.The code includes a custom function you may experiment with and a greatest common divisor calculator.