My teacher told me that if I wanted to get the best grade in our programming class, I should code a Simple Source Code Converter.
Python to Ruby (the simplest he said)
Now my question to you: how hard is it to code a simple source code converter for python to ruby. (It should convert file controlling, Control Statements, etc.)
Do y...
My teacher has given me two bnf grammars:
A ::= 'd' | A 'e' A | A 'f' A
B ::= 'd' | B B 'e' | B B 'f'
and four strings to match with them:
dffd
dddefddfe
dedf
deded
I've figured out two of them, but the other two have me stumped. I don't want anyone to tell me the answers, but if someone could give me some hints as to where I'm...
I'm trying to insert nodes into a tree in order. My function works fine... when there's only three nodes.
I have this code:
typedef struct _Tnode Tnode;
struct _Tnode {
char* data;
Tnode* left;
Tnode* right;
};
Along with this:
Tnode* add_tnode(Tnode* current_node, char* value) {
Tnode* ret_value;
if(current_node == N...
Hi, I am studying for my midterm exam. There is going to be a question about setting up an array dynamically, and maybe doing a copy constructor, a destructor and overloading the assignment operator. Can you please verify if I am correct. Also I don't understand what overloading the assignment operator means. Can you help me out with ...
I need to create a program that calculates out what percentage chance any of 3 randomly generated numbers (1-100) is higher than 99.
Can you help me break this down into smaller parts so it's easier to accomplish?
...
I'm trying to look up this problem but I don't know what it's called. The premise is this:
Given m machines and j jobs, where each job can only be assigned to machines i through j, I need to assign the jobs to machines so that I maximize busy machines at one time. I am only concerned with how they are assigned at time 0. I am not concer...
Say you have n GPS coordinates how could you work out the central gps point between them?
...
I am in a compilers class and we are tasked with creating our own language, from scratch. Currently our dilemma is whether to include a 'null' type or not. What purpose does null provide? Some of our team is arguing that it is not strictly necessary, while others are pro-null just for the extra flexibility it can provide.
Do you have an...
How to get the fraction length? If at all possible, without using string operation or loop
should all return length of 3:
5.234
5.23400
5.234000
Any programming language is accepted
[EDIT]
Not a homework, I want to display fractions at its minimum. Example, I defined numeric(18,8) in database. If the user entered only 5.234, the d...
like 17, is a prime, when reversed, 71 is also a prime.
We manage to arrive at this code but we cant finish it.
#include <stdio.h>
main()
{
int i = 10, j, c, sum, b, x, d, e, z, f, g;
printf("\nPrime numbers from 10 to 99 are the follwing:\n");
while (i <= 99)
{
c=0;
for (j = 1; j <= i; j++)
{...
I'm starting my 2nd class in C# programming through Kaplan online school. I have some limited interaction with the professor and the class online, but nothing like in an actual school. I'm about to go through "Modern Software Development Using C#.NET" by Richard Wiener. It seems the book as a extremely heavy focus on UML (which I don't e...
These are my questions:
I'm getting a couple of errors on the line "public static boolean validNumCheck(String num){" - "illegal start of expression", "';' expected", and "')' expected".
How can I give the user 3 tries in total for each number? I believe right now the programme asks the user for 3 numbers and gives them 3 tries in tota...
I am suppose to create a vector array in C to use in my project. I have not worked with such data structure before, and can't seem to find good information on it.
Can you provide a link to information or post the information which describes this data structure in regard to its usage, benefits, and the functions it has.
An implementatio...
I have to implements a function that takes a string as an input and finds the non-duplicate character from this string.
So an an example is if I pass string str = "DHCD" it will return "DHC"
or str2 = "KLKLHHMO" it will return "KLHMO"
...
I have the following problem, and am having trouble understanding part of the equation:
Monte Carlo methods to estimate an integral is basically, take a lot of random samples and determined a weighted average. For example, the integral of f(x) can be estimated from N independent random samples xr by
for a uniform probability distribu...
Working on (what should be) a simple project, taking the input from stdin and reformatting it to match the output specs. I'm just wanting to see what the experts here think of the following function that is supposed to skip k chars up to the end of the line, unless k < 0, where it will keep skipping chars until it reaches newline.
1 #...
Hello, I am a newbie in programming and I want to write a program in Visual Studio with using C# language which uses a textbox and a button only. When the user writes string "A" in the textbox and presses the button, the program shows integer "5" in a messagebox. If the user writes string "B" in the textbox, the program shows integer "4"...
Update: My current question is how can I get my code to read to the EOF starting from the beginning with each new search phrase.
This is an assignment I am doing and currently stuck on. Mind you this is a beginner's programming class using Python.
jargon = open("jargonFile.txt","r")
searchPhrase = raw_input("Enter the search phrase: ")...
I basically want to get the parallel port input & want to give the output simantanously in the c#.net with out using the inpout32.dll. Can any one guide me how to control the parallel port in c# with out inpout32.dll. And how to get input and give output parallely?? I m using the data pins for the output and control and status pins for t...
Hi Experts,
How do i find the longest path from single source to all final destinations
i.e. For source i1, Give longest path between i1 -> o1 and i1 -> o2.
The legends described in the above graph are as follows:
(i1, i2) are start nodes
(o1, o2) are end nodes
(1-8) are sub graphs
The edges may have +ive/-ive weights
The lon...