25
It's very easy:
Create a program without writing a single line of code. The code may only consist of existing Stack Overflow questions and answers.
The program should create two random numbers and output the numbers
- added to,
- subtracted from,
- multiplied with and
- divided by
each other.
Rules
You must include links to the questions/answers you used in your answer. You may not modify the code you find, with the following exceptions:
You may rename variables, functions, and methods. (This doesn't mean you can change a method invocation, by changing, say scanner.nextInt() to scanner.nextLine() and claiming that you're changing a method name. The change must be in the definition or reference to the same entity.). The solution should still work if variables, functions or methods would be renamed again.
You may adjust indentation appropriately.
You can assume that the proper modules are loaded for the code snippets to work. (e.g., import statements for Java and Python, using statements for C# and C++, and their equivalents in all languages) If the code snippet includes the imports for you, you can move them to the top of the code.
If the language requires the code to be in some kind of method body to execute (e.g.,
public static void main(String[] args)
for Java,static int Main(string[] args)
for C#, and so on), you can wrap your code in the appropriate method. But the contents of that main method must remain unmodified.You must supply an explicit list of any variable/method/function/class renamings performed.
You can't take snippets of snippets (meaning if you take a code block from a post, you take the whole thing) Provide a brief description of what the code does for people who aren't intimate with the language you're using. You must use snippets posted before this challenge was started.
Popularity contest, so the most upvotes wins!
Deadline
I will accept the the submission that has the most votes around the end of August, 6.
Hi michael, and welcome to PPCG stack exchange! One of the rules for code challenges on this site is that they must have an objective winning condition, so you should pick such a condition for this one. This is a similar challenge which might give you some ideas.
– isaacg – 2015-07-26T13:28:50.263Hi @isaacg, thank you. I'll have a look and delete/edit this one. – baao – 2015-07-26T13:30:24.723
@isaacg, hope it's okay now. You are more experienced than me here, is the deadline too close/far? – baao – 2015-07-26T13:48:24.830
It's much better. The deadline is much too close however, standard is about 1-2 weeks. – isaacg – 2015-07-26T13:49:11.510
Ok, thanks again. – baao – 2015-07-26T13:50:00.853
I'm waiting for the one guy that will go through all the ridiculous RegEx questions on SO to get a working Retina answer... – Fatalize – 2015-07-26T16:04:42.440
Haha, me too. @Fatalize – baao – 2015-07-26T16:05:14.477
Are we allowed to use both answers AND questions? Or just answers? – mbomb007 – 2015-07-28T15:57:55.293
You can use both! – baao – 2015-07-28T16:05:30.380