Can't Copy and Paste this?

Click here for a copy-and-paste friendly version of this code!

 

//**************************************

//     

//INCLUDE files for :A + - * / calculato

//     r

//**************************************

//     

#include 

#include 

#include 

 

code:

Can't Copy and Paste this?

Click here for a copy-and-paste friendly version of this code!

 

Terms of Agreement:   

By using this code, you agree to the following terms...   

1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for langauges that allow it) freely and with no charge.   

2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   

3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 

4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.  

//By Liam Murray liam_a_murray@hotmail.c

//     om

#include  // Input Output STREAM

#include  // STanDard Input Output

#include  // CONsole Input Output

float result,a,b; // declare result a and b

char c; // declare c

char yn; // declare yn

int sum()

    {

    textcolor(RED); // change the text color red

    cprintf("Enter Sum: "); //printf, only in color!

    cin >> a >> c >> b; // gets a b and c in one

    if (c == '+')

        {

        result = a + b;

    }

    if (c == '-')

        {

        result = a - b;

    }

    if (c == '*')

        {

        result = a * b;

    }

    if (c == '/')

        {

        result = a / b;

    }

    textcolor(GREEN); // guess

    cprintf("Answer: ");

    cout << result; // same as

    textcolor(LIGHTBLUE); // guess again

    cprintf("\n\rDo You Wan't To Do Another Sum?Y/N ");

    cin >> yn;

    if (yn != 'y') // if yn is different from y...

        {

        return 0; // exit the program

    }

    else;

    clrscr(); // clears the screen

    sum(); //restarts itself

}

int main()

    {

    sum(); // the first thing a program calls is

}// main(), but we want to run sum()