homework

Linking C++ code with 'gcc' (without g++)

Hi all: quick question: I'm in a situation where it would be useful to generate my C++ executable using only 'gcc' (without g++). Reason for this is that I have to submit the code to an automatic submission server which doesn't recognize the 'g++' (or 'c++', for that matter) command. In my experiments, while I'm compiling gcc works well...

Can you recommend a website for vhdl source codes?

I want a VHDL source codes website that provide a ready to use component source code. for example: full adder vhdl source code. ...

How do you make this code more pythonic?

Could you guys please tell me how I can make the following code more pythonic? The code is correct. Full disclosure - it's problem 1b in Handout #4 of this machine learning course. I'm supposed to use newton's algorithm on the two data sets for fitting a logistic hypothesis. But they use matlab & I'm using scipy Eg one question i have...

Unable to find an internet page blocked by robots.txt

Problem: to find answers and exercises of lectures in Mathematics at Uni. Helsinki Practical problems to make a list of sites with .com which has Disallow in robots.txt to make a list of sites at (1) which contain files with *.pdf to make a list of sites at (2) which contain the word "analyysi" in pdf-files Suggestions for practical...

Outcome of a small C program

We need to tell the outcome of the following C program: main() { int pid, k, som; som = 0; k = 2; pid = fork(); if(pid == 0) k=5; else wait(0); for(int i = 1; i <= k; i++) som += i; printf("%d", som); } My first expectation is 3. When a the fork call is made, the memory of the proces...

XSLT 1.0: sorting between multiple documents

<xsl:for-each select="//filenames"> <xsl:variable name="current_filename" select="."/> <xsl:for-each select=" document(.)//someNode[not( . = document($current_filename/preceding-sibling::node())//someNode )] "> <xsl:value-of select="."/> </xsl:for-each> </xsl:for-each> In the above code (XSLT 1.0), I ...

Count Letters in a File - Assembly

I have to make a program in Assembly Language for 8086 or 8088 processor. Where a given .txt file will have all its letters (from A to Z, not case sensitive) counted and later shown on screen. The ammount of letters in the file cannot pass the size of a word (16bits or 65535). in the end i show on screen something like this: A - 0001...

circle packing - java

I have a task to draw a circle and then fill in with the most amount of circles without touching the sides. I can draw the circle, and I can make loops to pack the circle in a hexagonal/honeycomb format, but can't control whether they are inside or outside the circle. I have used this: g.drawOval(50, 50, 300, 300); to specify my circle....

Getting NULL communicators with MPI_Cart_create, MPICH

Hi I wrote this program for my homework (parallel programming), but I'm getting some errors on running. This is the source: /**************************************** * Program: * * ALL_TO_ALL_BROADCAST_MESH * * * * Author: * * ------------------- * * ------------------- * ***************...

How to create a temporary text file in c++?

Hi, I'm trying to create a temporary text file in c++ and then delete it at the end of the program. I haven't had much luck with google. Could you tell me which functions to use? Thanks. edit: The answers below tell me how to create a temp file. What if I just want to create a file (tmp.txt) and then delete it? How would I do that?...

a C++ program to remove comments

Hi, I'm trying to create a program that takes a text file of c++ code and outputs another file with that code, minus any comments that it contains. Assuming that rFile and wFile are defined as follows: ifstream rFile; // File stream object for read only ofstream wFile; // File stream object for write only rFile.open("input.txt", ios:...

How to Generate a Map in Java?

I trying to complete a RPG game for a project, but have no idea on how to make the game map. It doesn't need to be graphical, but the code for the whole map and each tile must be correct. So far, I thought about making a non-matricial map (as request by the professor) by using an ArrayList which contain all the linked tiles. public abs...

Visualize B-Spline in .NET

I might need to visualize a B-Spline ( http://en.wikipedia.org/wiki/B-spline ) in .NET. I do not where to start. Is there any easy way or library to do it? I would prefer to do it in Silverlight but WPF and Win Forms is also fine. I imagine the software as a coordinate system with some control points that you can add, delete or move arou...

Making an index-creating class in C++

Hello everyone, I'm busy with programming a class that creates an index out of a text-file ASCII/BINARY. My problem is that I don't really know how to start. I already had some tries but none really worked well for me. I do NOT need to find the address of the file via the MFT. Just loading the file and finding stuff much faster by searc...

copying a text file- c++

I'm copying over text from one file to another, with certain changes. I have input.txt, tmp.txt and output.txt. The idea is to copy a few lines over to tmp.txt (until we reach a delimiter), move the text from tmp.txt to output.txt, wipe tmp.txt and then continue the cycle until we reach the end of input.txt. I'm having trouble with ...

How do I use PHP's preg_match to validate strings?

Please tell me how to use the various symbols used for expression matching in preg_match function of PHP. Besides basic information, please give example for checking a valid e-mail address and a string that should not contain / : ; { } * & ...

How to create a turing machine that serves as function calculator for x^y

I'm studying for a test on turing machines, and I'm stuck with a problem in which I have to create a Turing Machine that serves as a function calculator for: f(x,y) = x ^ y I understand my tape input would come separated like this: 1's of base 0 1's of exponent With my tape output being like 1's of base 0 1's of exponent 0 1's of...

Permutations and Combinations - Runtime Failure

This program takes 2 numbers from user input, asks them whether they'd like to find out the permutations or combinations, and then outputs the result. Here's the code. #include "std_lib_facilities.h" int permutation(int first, int second) { int top_fac; int bottom_fac; for (int i = first-1; i >= 1; --i) top_fac *=i; for (int i2 = (...

Need help with my heap sort

I'm kind of stuck with my heap sort here in php: <?php function heapSort($a, $count){ $a = heapify($a, $count); $end = $count - 1; while ($end > 0){ $temp = $a[$end]; $a[$end] = $a[0] ; $a[0]= $temp; $end = $end - 1; siftDown($a, 0, $end); } return $a; } function hea...

Create Microsoft Word document from C++ in Visual Studio 2005

Hi. We got a homework assignment to create a Microsoft Word document using Visual Studio 2005 and C++. Could anyone explain how this could be done. I was trying to do it using VSTO, but I've had no luck. All resources on the internet I could find explain how this could be done in VB or C#, but I need some C++ examples. Thanks EDIT: Acc...