I am trying to create a NFA from a regular expression. I have a grasp on reading in the regular expression and being able to make a stack from it. The part I am struggling on is mapping the characters in the regular expression to an integer indicating the variables order in the expression. I am just not sure how to go about this.
My code so far...
Code:
#include<stdio.h>
#include<stdlib.h>
#include "stack.h"
int main(void)
{
char expression[80];//array to store regular expression
I have an EDI file whose structure is given below. This file has multiple records, each record contains a header (e.g EDI.DD.0000000001.20130809), then contents (i.e multiple paragraphs of text) and then footer (e.g End of Report/No EDI Activity). I have to read that entire file using regular expression using three groups.
I am using following regular expression to read the file.
That expression reads the "header" and "footer" in respective groups properly but didn't pick the contents between header and footer in "contents" group.
I have changed the font of header and footer in below file to understand the format. I am using asp.net 3.5 framework.
//------------------Start of EDI File---------------------// EDI.DD.0000000001.20130809
ORIGINATOR INFORMATION Company Name: UNITED HEALTHCAR Identification: 9024125001 Originating DFI: 002100002
RECEIVER INFORMATION Receiver Name: HEALTH & WELLNESS DFI Account Number: 0000000000000001 Receiving DFI ID: 434343430 ID Number: Transaction Type: 22 Deposit
So I need to use boost/regex for regular expressions. someone told me that it needs to be built. the first problem is boost doesn't tell you how to build it and the second is i did sudo apt-get install libboost something. I don't remember the exact name of the package. it installed but i dont know how i would build it when its installed.
I really do not see the difference between these two declarations:
int myvariable; int * mypointer;
It is said that when you define a pointer, instead of containing actual data, it contains a pointer to the memory location where information can be found.
But doesn't the other variable declaration do the same? It obviously doesn't have data either. And it must be stored in a memory location as well. So I do not see the difference.
In order to parse mathematical expressions I am trying regular expressions and a recursive algorithm, but I have a problem with the four basic operations: +, -, *, /.
Trying to analyze a string like "a+(b+c)", if I use the pattern for a sum "(.+)+(.+)" the program matches it recognizing as subpatterns: "a+(b" and "c". How could I achieve the program to try also the other possibility?
I think that it would be great something like an regex_iterator which worked with regex_match instead of regex_search. I mean, an iterator that iterates over all the possible ways to match a given regular expression and a given string. This way I could loop through all these possibilities until the two subpatterns produced were correct mathematical expressions.
I have programmed a program for billing system. I have used parameters and arrays. All the functions are working except a one function. (Regular package function).
#include <iostream> #include <fstream> #include <string> #include <ctime> using namespace std; void main(int &minutes, int &minutesd,int &minutesn) {
i built a programming language called jade that right now can only print. i want to add variables to it however. I am going to use a modified bajarne stroustrop calculator to handle expressions (ie will now include string manipulations and such), but I want to build a var class into the program to make it easier for the program. i want variables to act like python variabes, and arrays to act like python associative arrays. Ive scoured different containers, but they only work if the variable isnt an array in my language, because it will only have one type. the only thing i can come up with is a union and 4 overloaded = operators (for bool, int, double, and string) is there a better way to do this?
Basically I want to embed the QGIS canvas widget into a custom application. In order to do that, I need to build QGIS from it's source in order to obtain the devel *.lib, *.dll, *.h, etc. files required. To that result, I am trying to build either version 2.6.* or the current nightly build ~2.7 - 2.8 64 bit version. There is very little documentation on the x64 builds. Not to mention that CMake and I are not the best of friends.
My progress so far: - Successfully built the extremely out of date nightly build readme instructions of version 0.11 x86 - Partial success in creating CMake output to VS2010, but many required headers were not included such as gqsmapcanvas.h, (So even if I got it building I couldn't use the canvas widget in an application) *Note I updated the external packages to x64 versions, so it is not an architecture mismatch issue.
I have also had issues with QWT looking for QWT Polar header files, but I suspect this is another issue with the missing headers as most of the errors related to files contained in the original source from GIT.
Code: 1 121 12321 1234321 123454321 EDIT: the above pyramid looks like a doom.i.e 1-5 will be in center.1-4(L)1-3(L)1-2(L)1(L) similarly 1-4(R) 1-3(R) 1-2(R) 1(R)
I'm partly successful in building the requirement of the program.but cant able to think the logic for the other half. how can i proceed.below is the code written in c#.
Making/Building 3D Game Engines, Do I need to know anything related to ART or graphics in order to make them ? I mean, I do know that having a know how about vectors is VERY important, But I am no good at art, I suck. I have thought of getting a separate guy to do the art, as I'm more interested in writing code and then implementing it making use of the art that has been made, I'm just worried if I need to or not need to know anything about sketching or art in order to write a 3D Game engine ?
I am just getting back in to C++ after 10 years not doing any, contributing to an open source project. I'm adding in some functionality and am hitting a road block.
I need to send a multicast packet out on the network that is structured in a certain way. I have the definition, and know what data is going in each byte. I can successfully send a message using multicast, I now just need to send the right message.
I have used a char array to hold the message, as each char represents 1 byte, and I can transmit the array.
I am having trouble putting all of the data in the right place though. If my source data is a string, then I seem to be able to convert it, but if it is a short or int, then I keep getting errors when compiling. Similarly, two of the lines, (version and type) i initially tried using char arrays with a length of one.
Should I be using memcpy or a different function, or even be doing this in a totally different way altogether? This is the code that I am using, along with the packet structure:
//Construct a Zone Query packet // 4 bytes - Signature "Ohz " = 0x6f, 0x68, 0x7a, 0x20 // 1 bytes - Version = 1 // 1 bytes - Type (0 = Zone Query, 1 = Zone Uri) // 2 bytes - Entire message length = 12 + zone length // 4 bytes - Length in bytes of the zone ID // n bytes - Zone ID to query
[Code] ....
The errors that I get are:
error: invalid conversion from ‘short int’ to ‘const void*’ [-fpermissive] memcpy(buffer + 6, packetLength, sizeof(packetLength)); ^ [Code] ....
I am trying to build a destructor that takes an array pointer and outputs part of a private vector and, comparing a string within the objects, overwrites the data in the array with the data in the vector. (vector and array use same class type) It then proceeds as usual.
I'm using a database and im trying to sort a 2D array info[51][10] that contains 51 pieces of records and 10 different fields for each record. And, now I'm trying to sort a desired field in the 2D array alphabetically.
However, the other fields within the same record should be swapped together. (So that the information of the same records stays together).
Also, I am constantly experiencing a run-time error. Sometimes my program works sometimes the whole thing crashes... By opening the code in different folders sometimes works. But the problem is still here. Is there any way to fix this error?
bool swapped =true; int j=0; string tmp[10]; swapped =true; j=0;
Within that proxy I want to analyze data before it reaches it's destination and have full control over it to the point where I can prevent a packet from reaching it's destination if my program finds something suspisious going on. I need incoming and outgoing traffic of specific adresses and ports to be forwarded into my application on my client machine. My app then should deliver packets to their destination after they were analyzed.
The parts where data is received, analyzed, manipulated if needed, and sent is something I could code with no difficulty. But the concept of redirecting and forwarding is hard for me to grasp at the moment. I'd like to know at least what winsock functions I have to use.
If it's possible, I would like to use Windows libraries only, nothing from 3rd parties.
I need to modify the program to use annual interests rates of 3%, 4%, and 5%.
After that I need to modify the program to make it so the user enters the dollar amount of the deposit, the interest rate or rates, and the number of years.
I'm a design student at New England Tech but before we can go full design they want to make sure we know for sure if we want to be a designer or a programmer and so we need to take C++ classes
The project builds on Win32 platform, but not on x64.
Full error message: dllentry.obj : error LNK2001: unresolved external symbol "class CFactoryTemplate * g_Templates" (?g_Templates@@3PAVCFactoryTemplate@@A)
The dllentry.cpp (a DirectShow base class) compiles on both platforms. It contains the external declarations:
extern CFactoryTemplate g_Templates[]; extern int g_cTemplates; g_Templates[] is then used in two functions: __control_entrypoint(DllExport) STDAPI DllGetClassObject(__in REFCLSID rClsID, __in REFIID riid, __deref_out void **pv)
[Code]...
myClass.cpp contains the definitions for the two externals in dllentry.cpp, at top level, just after the includes:
CFactoryTemplate* g_Templates=0; int g_cTemplates=0;
myClass.cpp also compiles by itself, but the project does not build. I checked all the libraries in the project settings and all seems to be OK, the 64 bit versions are used.
What should I do to make the project build for x64 platform?
I'm writing a program that calculate the carbon footprint for car, building, and bicycle. i have three classes building, car, bicycle. class called carbonfootprint have the pure virtual and should have the formula, but i didn't find it. having a little bit hard understanding some requests. like,
• Write an abstract class CarbonFootprint with only a pure virtual getCarbonFootprint method. Have each of your classes inherit from that abstract class and implement the getCarbonFootprint method to calculate an appropriate carbon footprint for that class.
• The main() function in the given program creates objects of each of the three classes, places pointers to those objects in a vector of CarbonFootprint pointers. You need to iterate through the vector, polymorphically invoking each object’s getCarbonFootprint method.
// Test program for CarbonFootprint and implementing classes. #include <iostream> #include <vector> using namespace std; int main() { vector< CarbonFootprint* > list; // add elements to list
I'm currently working on a Scheme Interpreter written in C. I'm trying to create a cons cell structure via recursive descent parsing, except instead of just having the car and cons, I also have a field that holds the token that I receive from the lexical analyzer (which was provided to us). The struct for what I'm describing is as such:
typdef struct node node; typedef node* list; struct node { char* symbol; list car; list cdr; };
Thus a cons cell would be (with a node represented as [symbol][car][cdr]), [null][car][cdr], while a symbol would be [symbol][null][null].
In the top answer for a similar question on Stack Overflow, one of the suggestions was to put the tokens into a stack as the input is recursively parsed, and then from that stack input it into the cons cell structure.
This is something that I'm working towards now, as it is easier for me to understand and I already have implemented a stack in C before, but I know that I can just build the structure recursively, I'm just not sure how. The following is code that I have:
list s_expression() { list local; list temp; if (strcmp(token, "(") == 0) { strcpy(token, getToken());
[Code] .....
s_expression is supposed to return a pointer to a recursively built cons cell structure. I'm just having issues figuring out when to call getToken(), as I either call getToken in the wrong spot and unintentionally skip over a token, or I call getToken() when I'm done getting all of the tokens, thus causing my program to continue searching for a token from user input instead of continuing on with the rest of the program.
When should I be calling getToken()?
In addition, what would be better, recursively building the cons cell structure as you go through the user's input, or putting all of the tokens into a stack and then building the cons cell structure using that stack?
If needed, I can post the lexical analyzer that's been provided to us. Also, for S_expression(); showing up as S_exp<b></b>pression();, I'm not sure what happened there. I copied this post from my question on stack overflow.