All pastes #200323 Raw Edit

Untitled

public cpp v1 · immutable
#200323 ·published 2006-10-13 02:37 UTC
rendered paste body
#include <cstdlib>#include <iostream>using namespace std;int main(int argc, char *argv[]){    int x; //lägsta    int y; //högsta    int z = 0; //summan    int same = 0; //om samma    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;            goto start;        }        else        {            cout << "\n Please enter the two numbers to calculate: \n\n" ;            cout << " First: ";            cin >> x;            cout << "\n Second: ";            cin >> y;            if(x>y)                swap(x,y);            if(a == 'a')            {                                                              y++;                while(x < y)                {                    z += x;                    x++;                          }            else if(a == 'b')            {                z = x;                while(x < y)                {                    z += x * z;                    x++;                }            }            else if(a == 'c')            {                y++;                z = 0;                while(x < y)                {                    z += x * x;                    x++;                }            }            cout << " The answer is: " << z << endl;            z = 0;        }    }}