homework

x86 question about bit comparisons

Im having a problem with a final part of my assignment. We get in a stream of bits, etc etc, in the stream is an integer with the number of 1's in the text portion. I get that integer and its 24 which is correct, now i loop through the text data i get and i try to count all the 1's in there. But my proc is always returning zero. I was a...

Malloc Error: incorrect checksum for freed object

I am working on implementing tail for an assignment. I have it working correctly however I seem to be getting an error from free at random times. I can't see, to track it down to a pattern or anything besides it is consistent. For example if I call my program as "tail -24 test.in" I would get the the the incorrect checksum error at the...

Agile programming for non-technical people

I'm supposed to give a presentation on agile programming techniques for my Business and Professional Communications class. One thing I'm having a bit of a problem getting right is the best way to give a quick and dirty overview of how agile programming works before I get into the meat of it. So what are some good ways to do this? Are ...

Generating a Deck of Cards

I'm trying to make a simple blackjack program. Sadly, I'm having problems right off the bat with generating a deck of cards. #include <iostream> #include <vector> using namespace std; int main() { vector<char> deck; char suit[] = {'h','d','c','s'}; char card[] = {'2','3','4','5','6','7','8','9','10','J','Q','K','A'}; f...

iterative version of recursive algorithm to make a binary tree

Given this algorithm, I would like to know if there exists an iterative version. Also, I want to know if the iterative version can be faster. This some kind of pseudo-python... the algorithm returns a reference to root of the tree make_tree(array a) if len(a) == 0 return None; node = pick a random point from the array c...

error handling when taking user input

Hello everybody, I am a beginner in c++ and I have a small problem: my code displays a simple menu to the user providing three options: cout << "\nQuadratic equation: a*X^2 + b*X + c = 0 main menu: "; cout << "\n <r> Give new coefficients"; cout << "\n <c> Calculate equations solutions"; cout << "\n <t> Terminate the program"; ...

Visio & UML - Showing pointers in attributes and return values

I have the requirement of generating UML Diagrams for one of my C++ assignments. I'm using Visio 2007 and I'm having trouble representing C++ pointers. I've found a way to add a suffix to Datatypes however it's rather time consuming to do this for every pointer used or returned in my program. Basically I'm trying to get -object1 : Obje...

Visio & UML - Showing vectors

I have the requirement of generating UML Diagrams for one of my C++ assignments. I'm using Visio 2007 and I'm having trouble representing C++ vectors. The only way I can see this working is creating a custom C++ datatype or creating a vector class in my project, then for each instance of a vector in the UML, I need to dig into the proper...

How do I convert a number to two's complement in verilog?

I am trying to design a 4-bit adder subtracter in verilog. This is only the second thing I have ever written in verilog, and I don't know all the correct syntax yet. This is the module I have so far: module Question3(carryin, X, Y, Z, S, carryout, overflow); parameter n = 4; input carryin, Z; input [n-1:0]X, Y; output re...

Making a custom Sin() function in Java

I have to create the sin function from scratch in my Comp Sci class, and I think I got it down. But it still has some problems. If I put in a value of .5PI or less it works. Otherwise it doesn't. Any help would be greatly appreciated. double i=1; double sinSoFar = 0; int term = 1; while(i >= .000001) { i = pow(-1, term + 1) * pow(sinOf...

I want a program that writes every possible combination to a different line of a text file.

OK, so basically what I want is a program that would print every combination of a set of variables to a different line of a text file, creating a word list. for example, print all binary number combinations possible up to for 1, 2, and 3 digits: 0 1 00 01 10 11 000 001 010 011 100 101 110 111 But putting each one of those answers on...

How do you go about compiling a modified version of FreeBSD?

I'm working on an assigned group project at University where we have to re-implement the TCP/IP stack to support some extra stuff (http://discolab.rutgers.edu/mtcp/), and then demonstrate it. The thesis/design we're working from says the original researchers changed the sourcecode for FreeBSD to support the extra bits and bobs. We've g...

Algorithm: Voyage planning

I need to plan a voyage connecting n locations in the sea with a specified origin and specified destination with following constraints. The voyage has to touch all locations. If there is a reservation from A to B then a has to be touched before B The time spend at each location varies (depends upon the reservations to that location) Eac...

Writing RegEx expression

Wanna write a RegEx to validate a driving license. if it doesn't start with (US, CA, CN) then it has to be followed with XX and after that with any number of Alpha numeric letters. So for example if the driving license starts with GB then it has to be followed with XX GBXX12345363 However if it starts with US then we don't care what ...

Can we output a picture in c?

Hi can we output a .jpg image or .gif image in c? I mean can we print a picture as output with the help of a c program?Aslo can we write a script in C language for html pages as can be written in javascript? Can the browsers operate on it?if not possible is there any plugin for any of the browsers? any example code or links please? ...

'\0' related problem..

Looking at this loop that copies one c-string to another: void strcpyr(char *s, char *t) { while(*s++=*t++)// Why does this work? ; } Why do we not check for the '\0' character in the while loop, like this? while((*s++=*r++)!='\0').. How does the first loop terminate? ...

Am I done with this Linked List code?

Hi I'm trying to get some practice with Linked Lists. I Defined an Object class called Student: public class Student { protected string Student_Name; protected int Student_ID; protected int Student_Mark; protected char Student_Grade; public Student() // default Constructor { Student_Na...

Java GUI LayoutManagers

I'm busy with an asignment where i have to make a graphical interface for a simple program. But i'm strugling with the layout. This is the idea: What is the easiest way to accomplish such a layout? And what method do you use to make layouts in java. Just code it, or use an IDE like netbeans? ...

How to manage and deal with a group of developers with different knowledge levels?

We are a group of students doing our Master degree in field of computer science. This semester we should do a Software engineering project according to the following bottom explanation. we should exactly act and report as a real Software engineering Team. I have been chosen as a project manager of this group, I am good in writing java...

Using Scheme code to solve a quadratic equation?

I wrote this scheme code to compute one solution of the quadratic equation a*x2 + b*x + c = 0 (define (solve-quadratic-equation a b c) (define disc (sqrt (- (* b b) (* 4.0 a c)))) (/ (+ (- b) disc) (* 2.0 a))) However, someone told me that this procedure is hard to understand. Why? What would a cleaned up version of this procedure lo...