0

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.

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).

What, if any way, is the most painless way to achieve this?

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.


EDIT: More details, if that helps:

In particular, I want to be able to do the following things that are easy in C++:

-Read from my own text file (thus, it would be on the server) and store the words I read into array-type structures

-Randomly select words from these arrays

-Assemble different combinations of these words in different ways, which depends on more random number generations

-Print an assembled sentence onto the screen


If still too broad (maybe I just don't know the potential scope of web applications!):

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. :

a and the ... #

cat dog frog Bob Joe astronaut programmer ... #

ate defeated slapped violated ... #

ran walked jumped ... #

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...

4

1 に答える 1