title: Running a C++ program on a web page
body: <p>I have a C++ program that generates a random sentence (with a word bank read from an accompanying text file) when it is run from the command line. </p>
  
  <p>I have a personal, low-traffic web page, and I would like to make this program run on the page (e.g., a visitor could press a button and a random sentence from the program would be displayed there). </p>
  
  <p>What, if any way, is the most painless way to achieve this? </p>
  
  <p>I'm a complete novice at web-related applications, but, to my understanding, these kinds of things are carried out with cgi, scripting languages, etc., which run on either the server or the user's machine and come with a lot of considerations about flexibility, feasibility, etc. </p>
  
  <hr>
  
  <p>EDIT: More details, if that helps:</p>
  
  <p>In particular, I want to be able to do the following things that are easy in C++:</p>
  
  <p>-Read from my own text file (thus, it would be on the server) and store the words I read into array-type structures</p>
  
  <p>-Randomly select words from these arrays </p>
  
  <p>-Assemble different combinations of these words in different ways, which depends on more random number generations</p>
  
  <p>-Print an assembled sentence onto the screen</p>
  
  <hr>
  
  <p>If <em>still</em> too broad (maybe I just don't know the potential scope of web applications!):</p>
  
  <p>The text file I use in the C++ implementation contains long lists of words that represent different parts of speech (plus a termination character '#'); each list is read into a different vector such as "articles", "nouns", etc. :</p>
  
  <p>a and the ... #</p>
  
  <p>cat dog frog Bob Joe astronaut programmer ... #</p>
  
  <p>ate defeated slapped violated ... #</p>
  
  <p>ran walked jumped ...  #</p>
  
  <p>So, along with being able to store things nicely, I'd probably want something that works in as many browsers as possible, but also something that's likely to be allowable on a host that is not my own. Not sure of what all needs to be considered, but learning as I go...  </p>