Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
i'm trying to make a windows form program to teach the c# language...

so i need to give an exercise ( like add 2 integers and show their sum )

the user must put their code in a text box and the compiler will process it



but now it comes that part ,, that the exercise might have more than one possible solution that gives the same result

and i want to check if the user's code is right ?


What I have tried:

i have the idea to put a verified solution in XML file and then run the 2 programs in parallel on the same examples and check the results

but how can i match the parameters to fit into the 2 programs ( maybe the user use more or less parameters or something ... ) !

any ideas please ? or there is another methods to compare 2 codes ?!




(sorry i didn't put any piece of code here ,, i don't think that this will make a difference .. i want to know how to compare 2 codes in general)
Posted
Updated 16-Dec-16 15:12pm
v2
Comments
PIEBALDconsult 16-Dec-16 18:08pm    
Kinda... don't?
Better to supply the definition of a method and have the user provide only the filling.
Jon McKee 17-Dec-16 0:36am    
Check the result only? I mean, as long as they submit code that reaches the valid conclusion what's the problem? To force a specific methodology would be both tedious to verify and stifle creativity.

1 solution

I hope you will get ideas in those sites.
This one is to teach you programming:
Learn to Program[^]
and this one is to teach you languages:
W3Schools Online Web Tutorials[^]
in both sites, you type your own code, and it is ok when you reach the wanred result.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900