homework

From within a bash script, how do I create a new filename, place a $variable in part of it?

Within a loop in my bash script, I am 'doing work', then writing the result of each iteration to its own file. I'd like to name these files # User-defined Function (UDF) processLine(){ line="$@" # get all args index=$(echo $line | gawk -F::: '{ print $1 }') content=$(echo $line | gawk -F::: '{ print $2 }') # Let's tr it to remove do...

Need help with an assignment from the MIT opencourse. Calculating prime numbers.

So, I have a very shotty background in programing and I have, for a very long time, attempted to learn through various lessons, though, no matter how good the lesson or tutorial is said to be, it always loses me at some point. For example the CarlH lectures lost me at around unit 5 part 1 and 2 where it jumped the shark and neglected to ...

Linked list problem

Hiii ... If we are given two linked lists (may be of different length) such that a few nodes from the end are common ... How do we find the first common node in least time as possible ... ? The lists are singly linked . Some nodes are common from the end and we need to find the first common one for both among them FROM THE END. ...

Inverse interpolation

find the Inverse interpolation of 3=58 x=97 8=126 ...

What is the algorithm for counting the number of 1's and 0's in a 16 bit number in lc3 machine language?

Provided adresses: x4000 - address of the input number x4001 - address to store count for 0's x4002 - address to store count for 1's ...

Code works extremely slowly and does not print output

I'm working on Project Euler problem #2: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... Find the sum of all the even-valued terms in the sequence which do not exceed four million. My ...

if a five-digit number is input through the keyboard, write a program to calculate the sum of its digits?

how i add five digit number by using modulus. i am beginner. by using the example say 12345. reply me fast. ...

Strange behavior of debugger when #line control is used

Hi, I used below code and tried to debug in Visual studio 2008 by pressing F10. //test.cpp #include<iostream> using namespace std; int main(void) { #line 100 "test.cpp" cout<<"Inside main()"<<endl; return 0; } Below is the debugger screen shot. #line 100 tells compiler to go to line 100 to get its next line. As 100th line do...

Problem with reading binary file to a deque

I'm writing a deque implementation with ArrayList as required by my instructor. So far the body of the class looks like this try { while (!endOfFile) { character = inputFile.readChar(); while (!character.equals('\u0003')) { if (character.equals('\u0008')) deck.removeBac...

What Architectures To Use With Cloud Computing

For my Software Architecture class, I'm trying to do a project on what software architectures work best with the cloud to create a scalable and agile application. I'm having trouble finding a starting place to research on what kinds of architectures work well with the cloud. Does anyone know any good books, blogs, articles, architectures...

Averaging 3 integers

My assignment is to fix the code. I have my edited code below and the original code below that. I figure I still have a few errors in here. My error checking doesnt seem to work, and I am not sure if my getchar() function is written or working properly. Please assume I know nothing becasue that is fairly accurate. The code compiles,...

c udp chat testing

I am writing a udp chat application in c. I need to test if messages are received in an incorrect order. CAn anyone please tell me of a tool I can use to delay certain messages? also please tell me how to use it? thank you very much in advance! also I am using ubuntu x86_64 and OSX 10.6.4. A tool in either OS will work ...

place a value in the sorted position immediately

Hello, I have a question for a c++ lab assignment I have. The task is to implement some function for adding values, remove values from an array and so on. I have done most of it now, however I have some problem with the insert function. The assignment requires me to insert float values to this array without using any algorithm to sort it...

the role of #ifdef and #ifndef

#define one 0 #ifdef one printf("one is defined "); #ifndef one printf("one is not defined "); In this what is the role of #ifdef and #ifndef, and what's the output? ...

About C program(find memory content)

Please, tell me what can i do... i am a beginner......i have no idea. please.... (if youn need more information please go to download)Mediafire>>> http://www.mediafire.com/?x6ult43663rpv35 Manually walk through the program.Write down the output that you expect will be displayed on screen. Run the program Observe the result and check f...

Crack the caesar cypher using SML

I just started university and managed to spend my entire first week sick, so I'm having a hard time figuring this out. I'm supposed to crack the caesar cypher. I have to declare a function crack : int * int -> int so that if (k, c) are of the type int, where k is the decrypted text and c the encrypted text, calling crack(k, c) will retu...

How to write a template ?

Hello, i need to write a template with Nodes containing data with 2 data structures : a map and a minimum heap, both got the same nodes in it and every 2 same nodes are connected. the problem is that i need the heap to know the node fields for the heapify for example, and i don't know what's the right way to do so, friends? public fields...

Limiting memory usage when reading files

I'm a Haskell beginner and thought this would be good exercise. I have an assignment where I need to read file in a thread A, handle the file lines in threads B_i, and then output the results in thread C. I have implemented this far already, but one of the requirements is that we cannot trust that the entire file fits into memory. I wa...

Stubs and main program

I have to design and implement a program to accomplish drum stick matching (not the eating one). There are two parameters I have to check i.e Weight and Pitch (acoustical property) for the two different drumstick and find pair of matching drumstick. I created three classes i.e Bin, Sorter and Stick and in project description Robot class ...

how to Override operator <

I'm trying to override operator < as the following : inside Node : bool operator <(const Node* other) { return *(this->GetData()) < *(other->GetData()); } inside vehicle : bool operator <(const Vehicle &other) { return this->GetKilometersLeft() < other.GetKilometersLeft(); } invoking the operator : while (index > 0 && m_he...