homework

read three files

create a c++ program that will read the three files and output the contents of the screen. ...

Guess Game.. in C#

hey all.. this is my code.. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace Guess_Game { class Program { static void Main(string[] args) { int quantity; int min, max; Console.WriteLine("Enter the Quantity of Numbers : "); quanti...

Fork() not working to calculate last few digits of command line arguments.

I' m trying to calculate the total sum of a line of command arguments entered in from the terminal. Thus far, I've gotten to the point where it will print out everything until the very last few digits. I have to make use of fork() to do all of the computation with my companion program. The main program is unable to do any computation for...

C Programming - Convert an integer to binary

Hi guys - i was hopefully after some tips opposed to solutions as this is homework and i want to solve it myself I am firstly very new to C. In fact i have never done any before, though i have previous java experience from modules at university. I am trying to write a programme that converts a single integer in to binary. I am only al...

Macro for concatenating two strings in C

Hey, I'm trying to define a macro which is suppose to take 2 string values and return them concatenated with a one space between them. It seems I can use any character I want besides space. for example: #define conc(str1,str2) #str1 ## #str2 #define space_conc(str1,str2) conc(str1,-) ## #str2 space_conc(idan,oop); space_conc woul...

How to implement a job scheduler

Hi, i would like to implement a job scheduler(from scratch as it is for university purpose) I want to run certain methods at intervals. the intervals may vary Do you have any suggestion? I really do not know where to start. Thanks ...

Trouble with reversing the order

I am trying to print out binary number in c however the dilemma i have is that its printing out in the reverse order. I have defined a function to tell me how many bits there are, this way i can work from the last bit back to get the nth bit i can use (value >> totalNumberOfBits) & 1; in a while loop i can run this until the totalNu...

Can i use the ordering methods of simple linked lists into a hash list?

Im confused with this question? Thank you in advance. Programming in C under linux ...

Complexity running times LAB and fibonacci numbers (java)

Hi, have been looking the page and lots of great people helping outhere so i have a Lab Assignment and i know i have to do a method concerning the fibonacci numbers to caclulate the number in the position n, but im not quite sure what do put inside the method i know is what i have to think about hope you can give and idea. Having trouble...

Hashtables and usage in Java

What is Hashtables used for in Java? Further more please give examples of simple usage of Hashtables. ...

Question about VB.NET constructors

I'm doing a lab for school, and I came across something I have never done before: create a default constructor within my class. It involves creating a private field to store the connection string, then create a default constructor that sets the connection string. Here is what I have so far: Public Class Appointments Private sqlcon...

Linked List explanation required

I need to understand how a linked list works in this C++ code. I got it from my textbook. Could someone explain in detail what exactly is going on here? /*The Node Class*/ class Node{ private: int object; Node *nextNode; public: int get() { return object; } ...

Can you please help me solve my Java programming exercise?

We are having a party with amounts of tea and candy. Return the int outcome of the party encoded as 0=bad, 1=good, or 2=great. A party is good (1) if both tea and candy are at least 5. However, if either tea or candy is at least double the amount of the other one, the party is great (2). However, in all cases, if either tea or candy is l...

Java Code Editing Help

Ok so I have a package for a Memory System...I have Class Memory, MemEl and Test....I need some help editing my code..i cant figure out whats wrong with it. So if you could give me some pointers or help me edit my code, it would be very helpful...Thanks...also for my MemEl I am trying to make a constructor for MemEl(Int), MemEl(long), an...

Reverse C-style String? - C++

Hi, I've written a small program for my programming class, that uses pointers to reverse a char array. I was wondering if there is anything that I should do differently? Am I doing this correctly? Is there a more efficient way to accomplish this? Thanks! My small program: int main ( ) { char buffer[80]; PrintHeader(); cout << "\nStr...

Find recurrence relation of this algorithm?

Assuming n=B-A+1, I need to derive the recurrence relation of this algorithm: void recurringalgorithm(int *a, int A, int B){ if (A == B){ for (int j=0;j<B;j++){ cout<<a[j]; } cout<<endl; return; } for (int i=A;i<B;i++){ dosomething(a[A],a[i]); recurringalgorithm(a,A+1,B); dosomething(a[A],a[i]);...

Why is my adjacency list showing duplicate edges?

#include <iostream> using namespace std; struct node { int v; node* next; node (int x, node* t) { v = x; next = t; } }; typedef node *link; int **malloc2d(int, int); void printMatrix(int **, int); link *convertToList (int **, link *, int); void printList (link * a, int size); // program begins fun...

Creating polymorphic recursive types in Haskell

Hi I'm trying to create a Tree type in Haskell. I've used this simple data constructor for storing a tree in which each node can either be empty, be a leaf containing an integer, or be a node containing an integer with branches to two other leaves/nodes. Here's what I've got: module Tree ( Tree(Empty, Leaf, Node) ) where data Tree = E...

Java Server Help!

I've followed a tutorial to create the socket server below which allows multiple users to connect and if they send some data to it then it returns it back to them. import java.awt.Color; import java.awt.BorderLayout; import java.awt.event.*; import javax.swing.*; import java.io.*; import java.net.*; class Cl...

Recursive descent parser for algebraic expressions in java

This is the grammar: Expression= expression+term|expression-term|term term=term*factor|term/factor|factor factor=id|expression I am trying to implement a recursive descent parser. This is the algorithm I came up with ** class main create expression object take input from user and send it to the expression class ** Class Expres...