Thread: Process Terminated with status -1073741510

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    3

    Process Terminated with status -1073741510

    My code is:

    Code:
    #include "header.h"
    
    int main(){
        int PAttack, PDefense;
        int EAttack, EDefense;
        int PDmgDealt, EDmgDealt;
        int PHP = 100, Php;
        int EHP = 100, Ehp;
        char input[4+1];
        int choice;
        Ehp = EHP - PDmgDealt;
        Php = PHP - EDmgDealt;
    
    
        srand(time(NULL));
    
    do{
        PAttack = rand() % 50 + 1;
        EDefense = rand() % 50 + 1;
        EAttack = rand() % 50 + 1;
        PDefense = rand() % 50 + 1;
    
        printf("1. Attack\n");
        printf("2. Skill\n");
        printf("3. Item\n");
        printf("4. Run\n");
        fgets(input, 4, stdin);
        choice = atoi(input);
    
        attacking( choice, PAttack, EDefense, PDmgDealt, EHP, Ehp, EAttack, PDefense, EDmgDealt, PHP, Php);
    } while(Ehp != 0);
        return 0;
    }
    Code:
    #include "header.h"
    
    
    void PDmgChk(int PAttack,int EDefense,int PDmgDealt, int EHP, int Ehp){
    
    
            PDmgDealt = PAttack - EDefense;
    
    
        // If Player's Attack is equal to the Enemy's Defense then do nothing
        if(PAttack == EDefense){
            PDmgDealt = 0;
            printf("You've dealt no damage");
            printf("The enemy now has %d", Ehp);
            printf(" HP\n");
        }
    
        // If Player's Attack is greater then the Enemy's Defense, deal damge
        else if(PAttack > EDefense){
            printf("You've dealt ");
            printf("%d", PDmgDealt);
            printf(" damage\n");
            printf("The enemy now has %d", Ehp);
            printf(" HP\n");
    }
    
    
    // If Player's Attack is less then the Enemy's defense do nothing.
        else if(PAttack < EDefense){
            PDmgDealt = 0;
            printf("You've dealt no damage! \n");
            printf("The enemy now has %d", Ehp);
            printf(" HP\n");
        }
    // Shows Player's Attack and Enemy's Defense REMOVE BEFORE FININSHING.
        printf("%d \n", PAttack);
        printf("%d\n" , EDefense);
        }
    
    void EDmgChk(int EAttack, int PDefense, int EDmgDealt, int PHP, int Php){
            EDmgDealt = EAttack - PDefense;
            // If Enemy's Attack is equal to Player's Defense, do nothing.
        if(EAttack == PDefense){
            EDmgDealt = 0;
            printf("The Enemy dealt no damage to you\n");
            printf("You now have %d", Php);
            printf(" HP\n");
    }
    
    // If Enemy's Attack is greater than the Player's Defense, deal damage.
        if(EAttack > PDefense){
            printf("The Enemy dealt ");
            printf("%d", EDmgDealt);
            printf(" damage to you.\n");
            printf("You now have %d", Php);
            printf(" HP\n");
    }
    
    // If Enemy's Attack is less than the Player's Defense, do nothing.
        if(EAttack < PDefense){
            EDmgDealt = 0;
            printf("The Enemy dealt no damage to you.\n");
            printf("You now have %d", Php);
            printf(" HP\n");
        }
    
        printf("%d\n", EAttack);
        printf("%d\n", PDefense);
    }

    Code:
    #include "header.h"
    
    void attacking(int choice, int PAttack, int EDefense, int PDmgDealt, int EHP, int Ehp, int EAttack, int PDefense, int EDmgDealt, int PHP, int Php)
    {
        switch (choice){
        case 1:
                Attack(PAttack, EDefense, PDmgDealt, EHP, Ehp);
                EDmgChk(EAttack, PDefense, EDmgDealt, PHP, Php);
                break;
        case 2:
                Skill();
                EDmgChk(EAttack, PDefense, EDmgDealt, PHP, Php);
                break;
        case 3:
                Item();
                EDmgChk(EAttack, PDefense, EDmgDealt, PHP, Php);
                break;
        case 4:
                Run();
                break;
    }
    
    }
    
    void Attack(PAttack, EDefense, PDmgDealt, EHP, Ehp){
        PDmgChk(PAttack, EDefense, PDmgDealt, EHP, Ehp);
    }
    
    void Skill(){
    
    }
    
    void Item(){
    
    }
    
    void Run(){
    
    }


    (Yes, I'm a newbie to coding, and sorry for the messy code.)

    But anyways everything else works here, but receiving -1073741510 upon termination of the program.
    Last edited by Varethien; 08-09-2011 at 04:10 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Process terminated with status -1073741819
    By smithx in forum C Programming
    Replies: 5
    Last Post: 11-01-2010, 11:13 PM
  2. I don't get what cause the following while loop to terminated
    By Overworked_PhD in forum C Programming
    Replies: 3
    Last Post: 08-11-2009, 09:30 PM
  3. Replies: 1
    Last Post: 02-04-2009, 06:54 AM
  4. Child process status
    By paraglidersd in forum C Programming
    Replies: 8
    Last Post: 07-24-2008, 10:51 AM
  5. get the status of the child process
    By mystic-d in forum C Programming
    Replies: 9
    Last Post: 11-17-2007, 04:59 AM