Click here to Skip to main content
14,303,876 members

C / C++ / MFC

 
GeneralRe: MFC CDialog hosting WPF components Pin
Member 88339813-Apr-15 4:36
memberMember 88339813-Apr-15 4:36 
QuestionHow to download a file from URL without using curl or libcurl ..in c++.? Pin
Member 87441111-Apr-15 23:42
memberMember 87441111-Apr-15 23:42 
AnswerRe: How to download a file from URL without using curl or libcurl ..in c++.? Pin
Jochen Arndt2-Apr-15 0:17
mveJochen Arndt2-Apr-15 0:17 
GeneralRe: How to download a file from URL without using curl or libcurl ..in c++.? Pin
Member 87441116-Apr-15 21:44
memberMember 87441116-Apr-15 21:44 
QuestionRe: How to download a file from URL without using curl or libcurl ..in c++.? Pin
David Crow2-Apr-15 4:04
memberDavid Crow2-Apr-15 4:04 
QuestionImplementing Finite State Machine using C++ Pin
Member 93502371-Apr-15 22:19
memberMember 93502371-Apr-15 22:19 
QuestionRe: Implementing Finite State Machine using C++ Pin
David Crow2-Apr-15 4:09
memberDavid Crow2-Apr-15 4:09 
AnswerRe: Implementing Finite State Machine using C++ Pin
CPallini2-Apr-15 6:31
mveCPallini2-Apr-15 6:31 
Quote:
but every article iv read about them is different and sometimes they leave out details, I couldn't understand it properly.

They are different because FSM are widely used, for different purposes.
There are not may details to understand. A finite state machine is a rather simple stuff. You should understand your scenarion, though.
By wild guess, you could do something like (or go with a more OO approach)
struct FSMData
{
  FSMState state;
  // other useful data
};

void update_fsm(FSMData & fsmd)
{
  switch(fsmd.state)
  {
  case STATE_MENU:
   handle_menu(fsmd);
   break;
  case STATE_GAME:
   handle_game(fsmd);
  //...
  }

void handle_menu(FSMData & fsmd)
{
  //...
  if ( userSelection() == PLAY_GAME)
  {
    // cleanup here
    fsmd.state = STATE_GAME;
    return;
  } 
  // ...
}

void handle_game(FSMData & fsmd)
{
  // ...
  if (userInput() == QUIT_GAME)
  {
    // cleanup here
    fsmd.state = STATE_MENU;
    return;
  }
  // ...
}

GeneralMessage Closed Pin
2-Apr-15 9:10
memberMember 93502372-Apr-15 9:10 
GeneralRe: Implementing Finite State Machine using C++ Pin
Sascha Lefèvre3-Apr-15 0:53
professionalSascha Lefèvre3-Apr-15 0:53 
Questionconst char error Pin
ForNow1-Apr-15 4:01
memberForNow1-Apr-15 4:01 
AnswerRe: const char error Pin
Richard MacCutchan1-Apr-15 4:07
protectorRichard MacCutchan1-Apr-15 4:07 
GeneralRe: const char error Pin
ForNow1-Apr-15 5:13
memberForNow1-Apr-15 5:13 
GeneralRe: const char error Pin
Richard MacCutchan1-Apr-15 5:17
protectorRichard MacCutchan1-Apr-15 5:17 
SuggestionRe: const char error Pin
David Crow1-Apr-15 5:13
memberDavid Crow1-Apr-15 5:13 
AnswerRe: const char error Pin
vishwadeepak mani tripathi2-Apr-15 8:05
membervishwadeepak mani tripathi2-Apr-15 8:05 
GeneralRe: const char error Pin
ForNow2-Apr-15 9:46
memberForNow2-Apr-15 9:46 
GeneralRe: const char error Pin
ForNow2-Apr-15 16:54
memberForNow2-Apr-15 16:54 
SuggestionRe: const char error Pin
David Crow3-Apr-15 3:23
memberDavid Crow3-Apr-15 3:23 
GeneralRe: const char error Pin
ForNow3-Apr-15 4:27
memberForNow3-Apr-15 4:27 
Question[C++]execute other program on second monitor Pin
Member 1156860630-Mar-15 19:22
memberMember 1156860630-Mar-15 19:22 
AnswerRe: [C++]execute other program on second monitor Pin
Richard MacCutchan30-Mar-15 23:13
protectorRichard MacCutchan30-Mar-15 23:13 
QuestionUnwanted radio button click Pin
lor7530-Mar-15 8:29
memberlor7530-Mar-15 8:29 
AnswerRe: Unwanted radio button click Pin
David Crow30-Mar-15 9:24
memberDavid Crow30-Mar-15 9:24 
GeneralRe: Unwanted radio button click Pin
lor7531-Mar-15 8:47
memberlor7531-Mar-15 8:47 

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.