|
-
Nov 22nd, 2001, 02:29 PM
#1
Thread Starter
Fanatic Member
My exe has encountered a problem and needs to close
-
Nov 22nd, 2001, 02:36 PM
#2
Member
This works fine for me (BC++5):
Code:
#include <iostream.h>
int main()
{
char c;
char *a = "What should be here?";
cout << "\nii) What do you want to do to " << a << "?\n\n";
cout << " A) Add something to it?\n";
cout << " B) Take something off it?\n";
cout << " C) Multiply it by something?\n";
cout << " D) Divide it by something?\n";
cout << " E) Find a percentage of it?\n";
cout << " F) Raise it to a power?\n";
cout << " G) Find the square root?\n";
cout << " H) Round it off?\n\n ";
cout << "-1-\n";
cin >> c;
cout << "-2-\n";
return 0;
}
-
Nov 22nd, 2001, 02:53 PM
#3
Thread Starter
Fanatic Member
Here is the first bit of code:
PHP Code:
int main()
{
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
long FnRound ( long , long );
void StrAppend ( char [], char [], long, char* );
long vercin (long , long , char [] , char []);
char inputbuffer [] = "";
char* Bmessage = "";
char* ca = "";
char c;
long a = -1;
long b = -1;
int mode = 1;
int msgloop = 0;
bool exitloop = false;
const Gray = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED;
const bBlue = BACKGROUND_BLUE;
SetConsoleTextAttribute(h, bBlue | Gray);
system("cls");
cout << "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\n";
cout << "º CALCULATOR º\n";
cout << "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ\n";
cout << "\n";
//SetConsoleTextAttribute(h, bBlue | Red);
//SELECT A
vercin (-9999, 9999, "Enter a number between -9999 and 9999", "Invalid Number");
cout << "\nii) What do you want to do to " << a << "?\n\n";
cout << " simple functions:\n";
cout << " A) Add something to it?\n";
cout << " B) Take something off it?\n";
cout << " C) Multiply it by something?\n";
cout << " D) Divide it by something?\n";
cout << " advanced functions:\n";
cout << " E) Add tax (17.55%) to it?\n";
cout << " F) Take tax (17.55%) off it?\n";
cout << " G) Find a percentage of it?\n";
cout << " H) Raise it to a power?\n";
cout << " I) Find the square root?\n";
cout << " J) Round it off?\n\n ";
cout << "-1-\n";
cin >> c;
cout << "-2-\n";
cout << "\n";
//SELECT OPERATION - SIMPLE
if (c == 'A')
{
StrAppend ("iii) Ok, add what to " ,"??\n ", a , Bmessage);
mode = 1;
}
else if (c == 'B')
{
StrAppend ("iii) Ok, take what off " ,"??\n ", a, Bmessage);
mode = 2;
}
else if (c == 'C')
{
StrAppend ("iii) Ok, multiply what by " ,"??\n ", a, Bmessage);
mode = 3;
}
else if (c == 'D')
{
StrAppend ("iii) Ok, divide " ," by what??\n ", a, Bmessage);
mode = 4;
}
else if (c == 'a')
{
StrAppend ("iii) Ok, add what to " ,"??\n ", a, Bmessage);
mode = 1;
}
else if (c == 'b')
{
StrAppend ("iii) Ok, take what off " ,"??\n ", a, Bmessage);
mode = 2;
}
else if (c == 'c')
{
StrAppend ("iii) Ok, multply what by " ,"??\n ", a, Bmessage);
mode = 3;
}
else if (c == 'd')
{
StrAppend ("iii) Ok, divide " ," by what??\n ", a, Bmessage);
mode = 4;
}
//SELECT OPERATION - ADVANCED
else if (c == 'E')
{
mode = 5;
}
else if (c == 'F')
{
mode = 6;
}
else if (c == 'G')
{
StrAppend ("iii) Ok, find what percentage of " ,"??\n ", a, Bmessage);
mode = 7;
}
else if (c == 'H')
{
StrAppend ("iii) Ok, raise " ," to what power??\n ", a, Bmessage);
mode = 8;
}
else if (c == 'I')
{
mode = 9;
}
else if (c == 'e')
{
mode = 5;
}
else if (c == 'f')
{
mode = 6;
}
else if (c == 'g')
{
StrAppend ("iii) Ok, find what percentage of " ,"??\n ", a, Bmessage);
mode = 7;
}
else if (c == 'h')
{
StrAppend ("iii) Ok, raise " ," to what power??\n ", a, Bmessage);
mode = 8;
}
else if (c == 'i')
{
mode = 9;
}
else
{
cout << "Sorry, your retardedness has gotten the better of you, \n" << c <<" wasn't one of the choices." << "\n";
cout << "Better luck next time." << "\n";
mode = 0;
}
PHP Code:
long vercin ( long minval , long maxval , char firstmessage [] , char secondmessage [] )
{
long buffer = 0;
bool accept = false;
do
{
cout << firstmessage << "\n";
cin >> buffer;
if (buffer <= minval)
{accept = false;}
else if (buffer >= maxval)
{accept = false;}
else
{accept = true;}
if (accept == true)
{}
else
{cout << secondmessage << "\n";}
} while (accept == false);
return buffer;
}
PHP Code:
void StrAppend ( char stringA [], char stringB [], long longA, char* strOut )
{
char ReturnStr [] = "";
char ConvLong [] = "";
itoa( longA, ConvLong , 10 );
strcpy(ReturnStr , stringA);
strcat( ReturnStr, ConvLong );
strcat( ReturnStr , stringB );
strOut = ReturnStr;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|