Hey, I posted earlier about arbitrary expressions and I did find solution to that. The question is how do I create random expressions? So far I've created codes to generate random operators and random numbers, how will I generate random expressions?

E.g. a1,a2,a3 are variables for random numbers I've assigned int r to generate random operators using switch statements.

How do I put this theory onto code exactly?

Thanks

Recommended Answers

All 5 Replies

Can you give some examples of the type of expressions you are looking for.
A technique for getting random operators would be to put them into an array and use a random number generator for selecting the operator.

It's okay mate, I've figured it out and submitted my coursework.

Thanks anyway =)

I guess that was a waste of time for everyone then.

Welcome to DaniWeb, and thanks for the sample code. Presumably you noticed that the OP "figured it out and submitted his homework" 10 months ago, so it's a bit late to help him!
For future reference, if you are publishing code here, please do not link to an external site (was that your own site?). Include the code in your own post, formatted as code by using the "code" button above the edit area.
Thanks
J

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.