homework

Dynamic allocation (malloc) of contiguous block of memory

For an assignment, I have to allocate a contiguous block of memory for a struct, but I'm first trying to do it with a 2D array of ints first and see if I understand it correctly. We had an example in the book that creates a block of memory for the pointer array (rows), and then initializes the cols and points the pointer to them. This ...

Learning Haskell: How to implement my own version of init function

As part of learning Haskell, I am trying to implement my own version of various functions associated with Lists. Right now I am stuck on the init function. init function in Haskell returns all the elements in a List other than the last element. Here is what I have done so far. init' :: [Int] -> [Int] init' [] = error "This function ca...

absolute Value of double

I am trying write a function named absD that returns the absolute value of its argument. I do not want to use any predefined functions. Right now i am getting a parse error when i try to compile it. I would image all i would have to do to get the absolute value of a double is change the sign bit? this is what i have #include <stdio.h> ...

C++ Sample Project - Need help with algorithm

Hello! I had one of my friends send me this programming assignment so I could brush up on some of my C++ skills. Below is the program description and my proposed algorithm. Could someone please provide some feedback/alternative solutions: Problem: This program creates word search puzzles - Words are printed at random locations in a rec...

Assembly language

I am very much a rookie. I am sure this is very basic but I have gone over this a number of times. I am trying to get my program to display a string on two different lines. This is a .com program and I am using A86 compiler. This is for HW and i am not trying to cheat or anything like that because I really want to know what I am doin...

Working with double-precision numbers in inline assembly (GCC, IA-32)

I'm just starting to learn assembly in my computer science class, and I have an assignment to round a floating-point value using a specified rounding mode. I've tried to implement this using fstcw, fldcw, and frndint. I modify the rounding control bits, round the number, and then restore the previous control bits (a requirement of the as...

implementing a registration class

hi i am a totally new guy on JAVA OO concepts ,and this is my first time programming,i am currently stuck on how to create a registration class and a class which will store all the registration info, this is what i have done, 4 classes, a Account class, a Staff class extend Account,a Student class extend Account, and a dataStorage class ...

Producing a clock glitch in a verilog design.

I am designing a chip using a verilog. I have a 3 bit counter.I want that when the counter is in its 8th loop , there should be a clock glitch and thereafter work normally.What could be the possible ways of producing a clock glitch in a verilog design? ...

Base8 = Base10 - How?

I know 75(base8) = 61(base10), but I can't easily find the formula for this. How does one convert from base 8 to base 10? ...

C# reference trouble...

Hi, I'm taking an algorithm course at the university, and for one of my projects I want to implement a red-black tree in C# (the implementation itself isn't the project, yet just something i decided to choose to help me out). My red-black tree should hold string keys, and the object i created for each node looks like this : class sRbTr...

Binary Addition of 2 values ( there is a catch :D) C# - RESOLVED

hey guys , im doin a final year project but it has come to a dead end as i dont know any way i can perform binary addition in C# what i am trying to do is i have two strings string a= "00001"; /* which is decimal 1 i made it with the '0's using string a = Convert.ToString(2, 2).PadLeft(5, '0'); */ string b= "00010"; what i want to...

how to store a very long integer value in c program for exam :- 98474737475747374739399

I have so store a very long value of type integer that can't be stored in a variable of long type. how can i store such a long integer value in a c programme. Please illustrate it through an example/ programme if possible. ...

reverse bit pattern in c

I am converting a number to binary and have to use putchar to output each number. The problem is that I am getting the order in reverse. Is there anyway to reverse a numbers bit pattern before doing my own suff to it? As in int n has a specific bit pattern - how can I reverse this bit pattern? ...

checking login algorithm

i am currently stucked on how to create a login algorithm which will login a user based on 2 HashMap objects namely Students and StaffMembers from a class DataStorage, i do not know after getting the texts input from LoginHandler() what do i do with them to compare it with my DataStorage . /* Class DataStorage*/ public class DataStorag...

Boolean Algebra Simplification

Need help have no idea the thought process in doing this kind of simplification. ! - Denotes NOT Lets say I have !((A+B) * (A+!B)) I need to simplify that using all rules except absortion. I know it is A * !B + !A * B but I need to know the process to get there. What is a good place to start. I do several different things but I never co...

How do I determine time passed between two Calendar Objects in Java?

What is the best way to count the amount of time between two Calendar dates in java. I am writing a method that determines the number of months that pass between two dates and returns a boolean based on a predefined term of months. This is my code(does not work correctly). This code always returns false. Also this code does not take int...

Can an int be null in Java?

Can an int be null in Java? For example: int data = check(Node root); if ( data == null ) { // do something } else { // do something } My goal is to write a function which returns an int. Said int is stored in the height of a node, and if the node is not present, it will be null, and I'll need to check that. I am doing this for h...

Javascript: Get the Index Value from an Array

Hi All, This is for a Java script course that Im taking... I need to create a simple user-login script. When the page loads a prompt pops up asking for the user name. If the correct username is entered, another prompt is displayed asking for a password. If both the username and valid, then you a sucessful message, otherwise you get ...

The All famous SA login in SQLSERVER : Can it be enabled differently ?

Hey Guys :D For my final year project, I'm making what I call - SeeQuaL and it's a one stop interface for accessing 3 of the most famous database types - SQLite, SQL Server and MySql. I'm Pretty sure that I can get things done with the SQLite and MySql. But SQL Server, meh! will surely give me problems. Now lets take the case that I ha...

getting information from different JComponents

i have a GUI that is mainly a survey, when the survey is finished the information would be extract to a table , i am currently having trouble getting all the information , i created a Actionlistener called finish handler which is attached to the survey GUI button "Finished" so when the finish button is clicked it will extract all the inf...