You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Programming Contest #1 - Calculator on Tue Feb 15, 2011 9:18 pm

The Professor

avatar
Contributor
Loading
Likewise, I've decided to start hosting programming contests with spare time. The reason for this is not only to challenge others, but to challenge myself as well. Now then, let's get to it.

Wink

Contest:

The user who writes a calculator with the least amount of code wins.


Reward:

x3 +rep

FAQ:

Q. What language can I use?
A. Any computer language.

Q. What functionality does my calculator have to pertain?
A. As long as your calculator is able to do basic arithmetic, it qualifies. Convenience is not the key aspect of this contest.


Rules:

No Plagiarism, doing so will result in an immediate disqualification and temporary ban from Computer Talks.

Deadline is February 21, 2011.

You can PM me your work or post it here.


I REPEAT, DO NOT SEND ME AN EXECUTABLE OR I WILL KILL YOU. Not really, it just won't qualify.
: 3


Bonus:

Anyone able to write a smaller calculator than mine will receive x5 +rep.

---------------------------------------------------------------------------------------------------------------

Now start your engines people!

cheers

My Calculator (Written in Perl):

Code:
#!/usr/bin/perl

BEGIN { print("##### Protozoid's Calculator ##### \n" . "\n") }

print("Select Your Operation: Addition, Subtraction, Multiplication, or Division. \n");

$operation = <STDIN>;

chomp($operation);

print("Select Factor One: ");

$factor1 = <STDIN>;

chomp($factor1);

print("Select Factor Two: ");

$factor2 = <STDIN>;

chomp($factor2);

if ($operation eq "Addition") {
    print("Result: ");
    print($factor1 + $factor2 . "\n");
}
elsif ($operation eq "Subtraction") {
    print("Result: ");
    print($factor1 - $factor2 . "\n");
}
elsif ($operation eq "Multiplication") {
    print("Result: ");
    print($factor1 * $factor2 . "\n");
}
elsif ($operation eq "Division") {
    print("Result: ");
    print($factor1 / $factor2 . "\n");
}
else {
    print("Invalid operation specified! Please make sure to note that the operations are case-sensitive, please state them according to the example given. \n")
}

END { print("Protozoid's Calculator is now terminated... \n") }

Pastebin: [You must be registered and logged in to see this link.]

2 Re: Programming Contest #1 - Calculator on Wed Feb 16, 2011 12:41 am

beeer

avatar
Fresh Meat
Loading
Code:
HAI
CAN HAS STDIO.h
PLZ OPEN FILE "LOLCALC.exe"
AWSUM THX
    VISIBLE FILE(visi)
ON OES
    INVISIBLE(invisi) "LOLERR0R"
KTHXBAI

Come at me, bitch.

3 Re: Programming Contest #1 - Calculator on Wed Feb 16, 2011 12:51 am

The Professor

avatar
Contributor
Loading
LOL, is this functional?

According to the code it only runs a calculator but doesn't perform functions on it. But you gave me an awesome idea, I now know that I could of made my calculator smaller using AutoIt rather than Perl.



Last edited by Protozoid on Thu Feb 17, 2011 12:57 am; edited 2 times in total

4 Re: Programming Contest #1 - Calculator on Wed Feb 16, 2011 1:18 am

Apocalypse

avatar
Master
Loading
Code:
Public Class Form1

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
     
        Label1.Text = "+"
        TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
     
        Label1.Text = "-"
        TextBox3.Text = (TextBox1.Text - TextBox2.Text)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Label1.Text = "x"
        TextBox3.Text = (TextBox1.Text * TextBox2.Text)
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Label1.Text = "/"
        TextBox3.Text = (TextBox1.Text / TextBox2.Text)
    End Sub
End Class

Made in Visual Basic 2008

5 Re: Programming Contest #1 - Calculator on Wed Feb 16, 2011 1:32 am

The Professor

avatar
Contributor
Loading
Thanks for participating Apoc. Though I personally don't like your code.
It's sloppy lol. I can only imagine how the UI looks, unfortunately I'm too lazy to run your code through Visual Studio.

6 Re: Programming Contest #1 - Calculator on Wed Feb 16, 2011 1:37 am

des

avatar
Achiever
Loading
I'm not sure if I should enter. But, I think I''ll still post mine. Neutral
Code:

#include <iostream>
#include <math.h>
using namespace std;
int main()
{
    int a, b, total;
cout << "Enter a number you want to add " << endl;
    cin >> a >> b;
total = a + b;
 
    cout << "The total sum is : " << total << endl;
    system("PAUSE");
    return 0;
}
Made in C++

7 Re: Programming Contest #1 - Calculator on Wed Feb 16, 2011 1:40 am

The Professor

avatar
Contributor
Loading
Mhm, you have some work to do on that. It's only able to addition operations.
The FAQ clearly states that your calculator must be able to do basic arithmetic (addition, subtraction, multiplication, AND division).

8 Re: Programming Contest #1 - Calculator on Wed Feb 16, 2011 1:41 am

Apocalypse

avatar
Master
Loading
Protozoid wrote:Thanks for participating Apoc. Though I personally don't like your code.
It's sloppy lol. I can only imagine how the UI looks, unfortunately I'm too lazy to run your code through Visual Studio.
lmao XDD k then.. if you want, i can take a screenie on how it should look. Razz

9 Re: Programming Contest #1 - Calculator on Wed Feb 16, 2011 1:42 am

des

avatar
Achiever
Loading
Protozoid wrote:Mhm, you have some work to do on that. It's only able to addition operations.
The FAQ clearly states that your calculator must be able to do basic arithmetic (addition, subtraction, multiplication, AND division).
I can add all that, but you already know I stopped C++, so there's really noting I can do. But, it's still work.

10 Re: Programming Contest #1 - Calculator on Wed Feb 16, 2011 2:07 am

The Professor

avatar
Contributor
Loading
[You must be registered and logged in to see this link.] wrote:
Protozoid wrote:Thanks for participating Apoc. Though I personally don't like your code.
It's sloppy lol. I can only imagine how the UI looks, unfortunately I'm too lazy to run your code through Visual Studio.
lmao XDD k then.. if you want, i can take a screenie on how it should look.

I stand correct, the UI is as sloppy as the code is.



But still, good job Apocalypse.

Sponsored content


Loading

View previous topic View next topic Back to top  Message [Page 1 of 1]

Related topics

Permissions in this forum:
You cannot reply to topics in this forum