All pastes #200331 Raw Edit

Anonymous

public cpp v1 · immutable
#200331 ·published 2006-10-13 02:48 UTC
rendered paste body
#include <cstdlib>#include <iostream>using namespace std;int main(int argc, char *argv[]){    int x, y, z;    char a;    for(;;)    {        cout << "|---------------------\n";              cout << "| Please choose:\n|\n" ;        cout << "|\n";        cout << "| a: Addition       ( 1+2+3 )\n";        cout << "| b: multiplication ( 1*2*3 )\n";        cout << "| c: Squaresum      ( (1*1)+(2*2)+(3*3) )\n|\n";        cout << "|\n";         cout << "| x: EXIT           ( Will exit the program. )\n|\n" ;        cout << "|---------------------\n";        cout << "| Enter: ";        cin >> a;            if(a == 'x')        {            cout << "\n BYE BYE :) \n" << endl;            system("PAUSE");            return EXIT_SUCCESS;        }        else if(a!='a' && a!='b' && a!='c')            cout << "ERROR: No such option\n" << endl;        else        {            cout << "\n Please enter the two numbers to calculate: \n\n" << " First: ";            cin >> x;            cout << "\n Second: ";            cin >> y;            if(x > y)                swap(x, y);			z = 0;            if(a == 'a')                for(y++; x < y; x++)                    z += x;            else if(a == 'b')				for(y--, z = x; x < y; x++)					z += x * z;            else if(a == 'c')                for(y++; x < y; x++)                    z += x * x;            cout << " The answer is: " << z << endl;        }    }}