All pastes #200305 Raw Edit

Cray

public cpp v1 · immutable
#200305 ·published 2006-10-13 02:12 UTC
rendered paste body
#include <cstdlib>#include <iostream>using namespace std;int x; //lägstaint y; //högstaint z=0; //summanint same=0; //om sammachar a;int main(int argc, char *argv[]){    start:    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;               }    if(a!='a' && a!='b' && a!='c' && a!='x'){               cout << "ERROR: No such option\n" << endl;               goto start;               }               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++;                          }               cout << " The answer is: " << z << endl;              }    if(a=='b'){               z=x;               while(x<y){                          z+=x*z;                          x++;                          }               cout << " The answer is:  " << z << endl;              }    if(a=='c'){               y++;               z=0;               while(x<y){                          z+=x*x;                          x++;                          }                   cout << " The answer is: " << z << endl;              }    z=0;                                  goto start;}// Made by Cray, 2006-10-13, 04:08