Click here to Skip to main content
15,886,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Where is GetTickCount64()? Pin
inlandchris12-Oct-17 2:14
inlandchris12-Oct-17 2:14 
GeneralRe: Where is GetTickCount64()? Pin
inlandchris18-Oct-17 8:25
inlandchris18-Oct-17 8:25 
GeneralRe: Where is GetTickCount64()? Pin
leon de boer18-Oct-17 9:09
leon de boer18-Oct-17 9:09 
AnswerRe: Where is GetTickCount64()? Pin
«_Superman_»11-Oct-17 19:03
professional«_Superman_»11-Oct-17 19:03 
GeneralRe: Where is GetTickCount64()? Pin
inlandchris12-Oct-17 2:40
inlandchris12-Oct-17 2:40 
QuestionVST programing Pin
Haiou10-Oct-17 18:44
Haiou10-Oct-17 18:44 
AnswerRe: VST programing Pin
Richard MacCutchan10-Oct-17 21:00
mveRichard MacCutchan10-Oct-17 21:00 
QuestionGenetic Prorgaming Pin
bluatigro9-Oct-17 2:19
bluatigro9-Oct-17 2:19 
this is a try at GP in C++ whit strings

GP what :
from array or grafic to formula

GP how :
1 : write random formula's
2 : sort formula's on error
3 : best fumula's mix to kid's
4 : some kid's are mutated
5 : if genration < max and error > whised goto 2

version 0.1.1
building function run
get "list" outof formula
 bluatigro 9 okt 2017
// genetic programing whit strings
// version 0.1

#include <math.h>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>

using namespace std ;

typedef VSTR vector<string> ;

VSTR split( string in , char cut = ' ' )
{
  VSTR uit ;
  size_type i = 0 ;
  size_type j = in.find( cut ) ;
  while ( j != string::npos )
  {
    uit.push_back( in.substr( i , j - i ) ) ;
    i = ++j ;
    j = in.find( cut , j ) ;
    if ( j == string::npos )
      in.push_back( in.substr( i , in.lenght() ) ) ;
  }
  return uit ;
}

string dbl2str( double x )
{
  stringsream ss ;
  ss << x ;
  return ss.str() ;
}

double str2dbl( string x )
{
// how ?
}

class GeneProg
{
private :
  int numberMode ;
  VSTR genes ;
  double in[ 10 ] ;
  int inmax ;
public :
  GeneProg()
  {
    numberMode = 0 ;
    inmax = 0 ;
  }
  string run( string prog )
  {
    int einde = prog.find( ']' ) ;
    int begin = einde ;
    while ( prog[ begin ] != '[' ) ;
      begin-- ;
    return prog.substr( begin , einde - begin ) ;
  }
} ;

int main()
{
  GeneProg GP ;
  string a = "[ + 7 [ - 2 3 ] ]" ;
  string b = "[ * 9 [ / 8 6 ] ]" ;
  cout << "[ test run ]" << endl ;
  cout << "prog a = " << a << endl ;
  //gp.run shoot give "[ - 2 3 ]"
  cout << "run a = " << GP.run( a ) << endl ;
  cout << "check a = " << 7 + ( 2 - 3 ) << endl ;
  cout << "prog b = " << b << endl ;
  //gp.run shoot give "[ / 8 6 ]" 
  cout << "run b = " << GP.run( b ) << endl ;
  cout << "check b = " << 9 * ( 8 / 6 ) << endl ;
  cout << "[ game over ]" << endl ;
  cin.get() ;
}

AnswerRe: Genetic Prorgaming Pin
David Crow9-Oct-17 2:39
David Crow9-Oct-17 2:39 
QuestionWhile loop not working on C. Pin
Tarun Jha8-Oct-17 0:23
Tarun Jha8-Oct-17 0:23 
AnswerRe: While loop not working on C. Pin
Richard MacCutchan8-Oct-17 1:45
mveRichard MacCutchan8-Oct-17 1:45 
GeneralRe: While loop not working on C. Pin
Tarun Jha8-Oct-17 3:36
Tarun Jha8-Oct-17 3:36 
GeneralRe: While loop not working on C. Pin
Richard MacCutchan8-Oct-17 6:15
mveRichard MacCutchan8-Oct-17 6:15 
GeneralRe: While loop not working on C. Pin
Tarun Jha8-Oct-17 6:24
Tarun Jha8-Oct-17 6:24 
GeneralRe: While loop not working on C. Pin
geodoom12-Oct-17 12:12
geodoom12-Oct-17 12:12 
GeneralRe: While loop not working on C. Pin
Tarun Jha13-Oct-17 5:40
Tarun Jha13-Oct-17 5:40 
AnswerRe: While loop not working on C. Pin
«_Superman_»8-Oct-17 17:59
professional«_Superman_»8-Oct-17 17:59 
GeneralRe: While loop not working on C. Pin
Tarun Jha10-Oct-17 5:24
Tarun Jha10-Oct-17 5:24 
AnswerRe: While loop not working on C. Pin
Tarun Jha11-Oct-17 7:15
Tarun Jha11-Oct-17 7:15 
SuggestionRe: While loop not working on C. Pin
David Crow11-Oct-17 7:46
David Crow11-Oct-17 7:46 
GeneralRe: While loop not working on C. Pin
geodoom13-Oct-17 7:24
geodoom13-Oct-17 7:24 
GeneralRe: While loop not working on C. Pin
Tarun Jha13-Oct-17 7:26
Tarun Jha13-Oct-17 7:26 
AnswerRe: While loop not working on C. Pin
Manish K. Agarwal12-Oct-17 4:33
Manish K. Agarwal12-Oct-17 4:33 
GeneralRe: While loop not working on C. Pin
Tarun Jha13-Oct-17 5:46
Tarun Jha13-Oct-17 5:46 
GeneralRe: While loop not working on C. Pin
David Crow13-Oct-17 16:13
David Crow13-Oct-17 16:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.