homework

Multiplication table in c

Tips on how to do multiplication table in c?? ...

how to store heterogenous objects in matlab?

I need to make an image pyramid in matlab for one of my assignments. Though there are inbuilt methods to get the individual images in the pyramid, I am confused about how to store the handles to the images. (I don't have much experience with matlab) Arrays don't work, since the images in the pyramid are of different size. I am looking f...

What's wrong with my program for "Write a program to count how many times each distinct word appears in its input using C++."

// Write a program to count how many times each distinct word appears in its input. #include <iostream> #include <string> #include <vector> int main() { // Ask for // and read the input words std::cout << "Please input your words: " << std::endl; std::vector<std::string> word_input; std::string word;...

Creating a very simple linked list

I am trying to create a linked list just to see if I can, and I am having trouble getting my head around it. Does anyone have an example of a very simple implementation of Linked list using C#? All the examples I have found so far are quite overdone. ...

Convert big endian to little endian when reading from a binary file

Hi I'm been looking around how to convert big endian to little endians. But I didn't find any good that could solve my problem. It seem to be there's many way you can do this conversion. Anyway this following code works ok in a big endian system. But how should I write a conversion function so it will work on little endian system as well...

Haskell - Concat a list of strings

Im trying to create a list of strings using some recursion. Basically i want to take a part of a string up to a certain point. Create a list from that and then process the rest of the string through recursion. type DocName = FilePath type Line = (Int,String) type Document = [Line] splitLines :: String -> Document splitLines [] = [] s...

I need help with a class diagram

Someone asked me this, what will be a good aproach? Design a model of a spreadsheet (like excel), but don’t be afraid, do it very simple! We only need a basic class diagram with no more than 5 or 6 classes. It should have the following features: The sheet will only manage numeric data There will be two types of cells: Cells that con...

Trying to make a program that imitates a Process Table

Hello,I am trying to create a program that is just like a Process Table. I have to implement a class PCB (Process Control Block) with several fields such as:process name (a string) process priority (an integer) register set values (an object of a class Register Set containing the following fields: XAR, XDI, XDO, PC. Then my program ne...

Haskell split lines into list including empty lines

So have this type DocName = FilePath type Line = (Int,String) type Document = [Line] splitLines :: String -> Document splitLines [] = [] splitLines str = zip [0..(length listStr)] listStr where listStr = [getLine] ++ map snd (splitLines getRest) ...

Compare Multiple Substrings

I'm attempting to write a basic dna sequencer. In that, given two sequences of the same length, it will output the strings which are the same, with a minimal length of 3. So input of abcdef dfeabc will return 1 abc I am not sure how to go about solving the problem. I can compare the two strings, and see if they are completely equal...

remove duplicate list elements

I want to remove the duplicate elements in a list only when one element is repeated many times, like this: li = ['Human','Human','Human'] => li = ['Human'] but not when there are two or more different elements: li = ['Human','Monkey','Human', 'Human'] Many thanks in advance. ...

Using kbhit() to pause terminal output?

I took my first 'fundamentals of programming' lab session at uni today. One thing struck me as odd, though: the use of while(! _kbhit()) from conio.h (which I'm sure is a C unit?) to 'pause' the console output. Is this the best way to do this? What do I need to watch out for when using it? Is my tutor absolutely bonkers? I only ask beca...

SQL Sub Query Help

I am having trouble with a homework question. Specifically, find the maker(s) who produce(s) a PC faster than all laptops. The query I am using is SELECT DISTINCT maker From Product Where model = (SELECT model FROM PC WHERE speed > ALL (SELECT speed ...

Algorithm for Postage Stamp Problem

The postage stamp problem is a mathematical riddle that asks what is the smallest postage value which cannot be placed on an envelope, if the letter can hold only a limited number of stamps, and these may only have certain specified face values. For example, suppose the envelope can hold only three stamps, and the available stamp values...

Simple class concepts in C++ (cards in a deck)

Hey you guys were absolutely great with my last problem so hopefully you can help clarify something else to me. Classes confuse me! For this particular assignment, we are to do the classic 'Cards in a Deck' program. We are to make two classes, one called 'Card' and the other 'Deck'. Now I've gotten a large chunk of this done so far but...

Calculate Area and Circumference of a Circle with input in C++

Hello again, I am writing a code for class and I thought I hat it all down pat. However, can not get any feedback from the input when I compile this on XCode. My code is as follows: /* James George Hayek PCCC Assignment 2 Prof Siegel This program will calculate the area and circumference of a circle. */ #include <iostream> #in...

Java: display number of times a letter appears in a string

This is from Sun's tutorial's exercise area so I suppose it is homework. I know how to use a for loop to iterate the string, but I wish to learn arrays while I am at it and store them in so. This is what I got so far: BufferedReader in = new BufferedReader(new FileReader("xanadu.txt")); int c; char letters[] = new char[27]; //26 + newl...

What do I need to know to write a client server socket program in Java using Caesar Cipher authentication?

I have an assignment called "Write a client server socket program in Java in which server will authenticate client using authentication algorithm." How do I get started? Which are the prerequisites of knowledge of computer security and socket programming to implement this? Any links to good tutorials? EDIT: Using Caesar Cipher ...

Bidirectionnal Bubble Sort in Java?

I need to implement the bidirectional bubble sort in my code. In other words in will go from left to right first carrying the largest value. But when it reaches out, it should reverse and go from right to left carrying the smallest value. I am advised to to implement another out index in addition the current one. This is what I have...

Using a file to find win percentage of teams in file

1) Write a function that reads a file of sports team win/loss records, and computes the win percentage of each. For example, using the file leagueRecords.txt: Lions, 20, 14 Tigers, 31, 0 Bears, 16, 17 Ohmy's, 11, 5 Ferocious Animals, 12, 8 Home Team Name, 15, 22 Screaming Eagles, 22, 13 Yelling Falcons, 16, 14 Loud-t...