Results 1 to 3 of 3

Thread: My exe has encountered a problem and needs to close

  1. #1

    Thread Starter
    Fanatic Member Illspirit's Avatar
    Join Date
    Mar 2001
    Location
    Blackpool, England
    Posts
    815

    Angry My exe has encountered a problem and needs to close

    Calc.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

    I get this error running my small program. Nothing is picked up in the debugger, and i'm pretty sure its here in my code:

    PHP Code:
            char c;

            
    cout << "\nii)  What do you want to do to " << << "?\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"
    Here I get a "-1-", then input, then it gives me the error and NO "-2-" on the console

    I'm new to c++ and i have no idea whats causing this


    Thanx for any help
    Illspirit - [email protected]

    SmartBarXP Lead Developer
    SmartBarXP - The leading desktop sidebar application for Microsoft Windows XP

  2. #2
    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;
    }

  3. #3

    Thread Starter
    Fanatic Member Illspirit's Avatar
    Join Date
    Mar 2001
    Location
    Blackpool, England
    Posts
    815

    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 [], longchar* );
            
    long vercin (long long  char [] , char []);

        
    char inputbuffer [] = "";
        
    charBmessage "";
        
    charca "";
        
    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(hbBlue Gray);
        
    system("cls");

        
    cout << "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\n";
        
    cout << "º                                  CALCULATOR                                 º\n";    
        
    cout << "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ\n";

        
    cout << "\n";
     
        
    //SetConsoleTextAttribute(h, bBlue | Red);

        //SELECT A
        

            
    vercin (-99999999"Enter a number between -9999 and 9999""Invalid Number");

            
    cout << "\nii)  What do you want to do to " << << "?\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 (== 'A')
            {
                
    StrAppend ("iii) Ok, add what to " ,"??\n     "Bmessage);
                
    mode 1;
            }
            else if (
    == 'B')
            {
                
    StrAppend ("iii) Ok, take what off " ,"??\n     "aBmessage);
                
    mode 2;
            }
            else if    (
    == 'C')
            {
            
    StrAppend ("iii) Ok, multiply what by " ,"??\n     "aBmessage);
                
    mode 3;
            }
            else if    (
    == 'D')
            {
                
    StrAppend ("iii) Ok, divide " ," by what??\n     "aBmessage);
                
    mode 4;
            }
            else if (
    == 'a')
            {
                
    StrAppend ("iii) Ok, add what to " ,"??\n     "aBmessage);
                
    mode 1;
            }
            else if (
    == 'b')
            {
                
    StrAppend ("iii) Ok, take what off " ,"??\n     "aBmessage);
                
    mode 2
            }
            else if    (
    == 'c')
            {
                
    StrAppend ("iii) Ok, multply what by " ,"??\n     "aBmessage);
                
    mode 3;
            }
            else if    (
    == 'd')
            {
                
    StrAppend ("iii) Ok, divide " ," by what??\n     "aBmessage);
                
    mode 4;
            }

        
    //SELECT OPERATION - ADVANCED
            
    else if (== 'E')
            {
                
    mode 5;
            }
            else if (
    == 'F')
            {
                
    mode 6;
            }
            else if    (
    == 'G')
            {
                
    StrAppend ("iii) Ok, find what percentage of " ,"??\n     "aBmessage);
                
    mode 7;
            }
            else if    (
    == 'H')
            {
                
    StrAppend ("iii) Ok, raise " ," to what power??\n     "aBmessage);
                
    mode 8;
            }
            else if    (
    == 'I')
            {

                
    mode 9;
            }
            else if (
    == 'e')
            {
                
    mode 5;
            }
            else if (
    == 'f')
            {
                
    mode 6;
            }
            else if    (
    == 'g')
            {
                
                
    StrAppend ("iii) Ok, find what percentage of " ,"??\n     "aBmessage);
                
    mode 7;
            }
            else if    (
    == 'h')
            {
                
    StrAppend ("iii) Ok, raise " ," to what power??\n     "aBmessage);
                
    mode 8;
            }
            else if    (
    == 'i')
            {
                
    mode 9;
            }
            else
            {
                
    cout << "Sorry, your retardedness has gotten the better of you, \n" << <<" 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 longAcharstrOut )
    {

    char ReturnStr [] = "";
    char ConvLong [] = "";

    itoalongAConvLong   10 );

    strcpy(ReturnStr stringA);

    strcatReturnStrConvLong ); 
    strcatReturnStr stringB ); 


    strOut ReturnStr;


    Illspirit - [email protected]

    SmartBarXP Lead Developer
    SmartBarXP - The leading desktop sidebar application for Microsoft Windows XP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width