Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

C++ my code keeps returning -1073741819 (0xc0000005), what is the problem?

atoaster

New Coder
C++:
#include <cmath>
    
    
    #include <stack>
    #include<queue>
    #include <iostream>
    #include <regex>
     #include <vector>
    #include <thread>
     #include <bitset>
    
     #include <ctime>
    
     #include <string.h>
    
     #include <math.h>
    #include <bits/stdc++.h>
    
     #define M_PI 3.14159265358979323846264338327950288419716939937510582097494
    
     #include<windows.h>
    #define gkey GetAsyncKeyState
     using namespace std;
    #define rxs regex_search
    #define loop while(true)
    double a;
    double num1;
     double c3 = 299792458;
     double c3sq = 89875517873681764;
     int mc;
         string again;
    
     stack<int> presedence;
     stack<string> oprators;
     queue<double> numbers;
     stack<char> test;
     double num5;
     double num6;
     int E;
     int abrt = 0;
     double num2;
    
     double ans = num1 + num2;
     int num;
     int numalt = 0;
     int numaltt = 0;
     //int nums [] = {srand(time(0));rand();}
    
    bool autoregex(string test){
        regex e ("[-+]?([0-9]*\.[0-9]+|[0-9]+)");
       if (regex_match (test,e))
            return true;
    
        return false;
    }
    bool autrege(string test){
        regex aret("SIN|LOG|sqrt|sin|log|tan|pi|e|ln|EE|[^0-9a-z$@#&\]");
                   if (regex_match (test,aret)){
                    return true;
                   }
    else{
        return false;}
                   }
                   void namehere(string test){
    if(autrege(test) == true){
    regex bret("[+-]");
    regex cret("[/*xX]");
    regex dret("SIN|LOG|sqrt|sin|log|tan|pi|!|e|ln|EE|\\^");
    regex omega("\\)");
    regex canmae("\\(");
    if (regex_match (test,bret)){num2 = 1;};
    if (regex_match (test,cret)){num2 = 2;};
    if (regex_match (test,dret)){num2 = 3;};
    if (regex_match (test,omega)){num2 = 4;numaltt = numaltt + 1;};
    if (regex_match (test,canmae)){num2 = 4;numalt = numalt + 1;};
    
    }
    
    
    
    
                   }
    
    int main()
    {
    vector<double> vec;
        again = "n";
    
     while(again == "n"&&abrt == 0){
     // queue<double> numbers; stack<int> pres;
            queue<string> output;
       int test;
     string name;
       getline(cin, name);
       istringstream iss(name);
     string token;
        while(iss >> token)
        {
          if(autoregex(token) == true){
                output.push(token);
          }
          if(autrege(token)== true)//token area
          {
    
    
              namehere(token);
              num6++;
              if(num2 == -1){cout<<"wrong move: ";again = "n";again = "y";cout<<num2<<endl;}
           while(presedence.empty() == 1 && oprators.empty() == 1)
            {
                presedence.push(num2);
                oprators.push(token);
           }
           while(presedence.top() < num2)
            {
            oprators.push(token);
            presedence.push(num2);
    
           }
    
           while(presedence.top() >= num2)
           {
            output.push(oprators.top());
            oprators.pop();
            presedence.pop();
           }
    //3-T 2-ME
          }
    
    }
    while(presedence.empty() != 1 && oprators.empty() != 1){  output.push(oprators.top());
    oprators.pop();presedence.pop();}
    while(!output.empty()){cout<<output.front()<<", ";output.pop();}
    
    }
    
    
    while(again != "n"&&abrt == 0){
    
    }
    
    
    }
 
I'm not sure that just throwing a big chunk of code into a forum and asking others to find your problem is the way to go. Have you not stepped through the debugger to find the statement that is crashing ?
 
Last edited by a moderator:

New Threads

Buy us a coffee!

Back
Top Bottom