homework

Converting a list with many items into single item lines in python

Hi, I want to convert lines in a text file from this: animal cat, mouse, dog, horse numbers 22,45,124,87 to this: animal cat animal mouse animal dog animal horse numbers 22 numbers 45 numbers 124 numbers 87 How would I do this conversion in python? Thanks ...

modulus in assembly

Hi, I am learning assembly language. Is there modulus operator in assembly? I know I can find the remainder using the formula Number= Divident * Divisor + Remainder. I have heard when we use the DIV syntax the remainder is stored in one of the register? Edit 1 : I am using Intel x86 Architecture and devloping it on Ubuntu. Thanks....

Propositional parameters

Hi everyone, below is an extract from a shell script i am tring to make, it is supposed to allow a user to supply files they want to view and the script prints the first lines of the each file and asks if they want to delete them. i have marked where the errors are, i know i am using the $ improperly. any help would be appreciated t...

Logical error in prime numbers.

Hi, I am new to assembly language. I have written a program for taking an input and then displaying whether the number is prime or not. Here is my source code. .intel_syntax noprefix .include "console.i" .data Num: .long 0 .text ask: .asciz "Enter a +ve number : " ansp: .asciz " is prime." ...

PHP - Function to Calculate Grade

Hey guys, I have been working on a solution/algorithm for a function to calculate a grade based on the grade type (Homework, Exam, Project, etc.). I've successfully implemented the function that gets the information I need to make the calculation, but I'm having trouble constructing the grade calculation function that takes all the grade...

IMAP allows creation of multiple mail boxes or folders in the mail box?

 IMAP4 provides the following extra features  User can  check header prior to downloading  Search contents of email for a string before downloading  Partially download emails  Create, rename or delete mailboxes on mail server  Create hierarchy of mailboxes in a folder for storage LAST TWO POINTS ?? one user...

classList in Haskell Help.

Hi guys, Can anyone help with my last assignment question that i got stuck on for 2 days straight. I'm suck at Haskell and this question seems to be too advanced for me, so please help me cos its due mid-night tonight. Any help is really appreciated. Here is my question. Your main task in this question is to define the function classl...

puzzle using arrays

My first array M + N size and second array of size N. let us say m=4,n=5 a[ ]= 1,3,5,7,0,0,0,0,0 b[ ]= 2,4,6,8,10 Now , how can i merge these two arrays without using external sorting algorithms and any other temporary array(inplace merge) but complexity should be o(n).Resultant array must be in sorted order. ...

Write an algorithm to return the prime numbers of an integer, for example if your input is 10 the output is list a with elements 2 and 5

this one i get as assignment in discrete maths. i try to do like this. procedure prime_numbers (x) n:= 1 for i:= to n<=x do n mod i=1 then return (prime) end prime_number. ...

Given the following class definition that is designed to emulate an array of integers :

class array { int * ptr ; int length ; void realloc (int) ; public : // all public functions declarations }; and the main( ) function : int main( ) { const int dim = 5 ; array a; a.initialize(dim); a.print(); for ( int I = 0; I < a.get_length() ; i++) a.store(i , i); a.print(); a.increment(); a.append(6); a.print(); a.reve...

parsing space separated text in C

I'm writing a program for a school project that is supposed to emulate the Unix shell, in a very basic form. It's basically parsing input, then doing a fork/exec. I need to be able to read arguments in the program (not as arguments passed to the program from the command line) individually. For example, I will prompt: Please enter a com...

C Program Exercise.. Help please..

Question : Program that asks the user to enter an item price value and then show how to pay that amount using the smallest number of $ 50,$20, $10,$5, and $1 bills consist. Example Output: Enter Price: 187 Enter Amount to pay: 500 Change is : 313 (6)$50 (1)$10 (3)$1 (0)$20 (0)$5 Here's my code: hope you help me , I am having a ...

C homework assignment, pipes and processes

I've asked many, many C questions here on stackoverflow over the past few days. I feel like I'm at the final one. My assignment works ALMOST perfectly. Here is the premise: Write a program to query the user for two input strings. Each input string should be a unix command, with arguments allowed. For example, input 1 could be ls -l and ...

Serialization of vectors in C++

Hello All, I'm trying to serialize a set of structs in C++. This works great for all data except a vector contained in my struct. I can write the data to disk, and then read all data back into memory. The only problem is when I try to access an element of the vector I get a segmentation fault. My code is below. Any help is greatly appre...

For C Language: How to do you Display a growing Series of Numbers using the For Loop per line?

How do you make C use the For Loop Statement and generate this: 1 12 123 1234 12345 123456 1234567 12345678 I know this requires that the value "1" to be continuously be multiplied with "10" and added with "1". ...

Need beginner help with C++ syntax

I am busy with an assignment an I am getting an error from the compiler. I've got 4 yrs C# experience nil in C++. I'm getting the error "Invalid conversion from nodeType, initializing argument 1 of void linkedListType::deleteNode(const Type&) [with Type = int]' " on the line deleteNode(current->link); of this function: template<class...

How do I find numbers that contain the sequence 666?

Not A Homework Question, We Are Still Studying Loops At School encountered in a programming challenge ... Start The number 666 is considered to be the occult "number of the beast" and is a well used number in all major apocalypse themed blockbuster movies. However the number 666 can't always be used in the script so numbers such as 1666 ...

write a c program/ factorial of N using do while

it factors a # 25=5 ...

finding a/b mod c

I know this may seem like a math question but i just saw this in a contest and I really want to know how to solve it. We have a (mod c) and b (mod c) and we're looking for the value of the quotient (a/b) (mod c) Any ideas? ...

How many objects were created in this code execution?

public class Animal { public Animal() { Console.Writeline("Animal"); } } public class Snake : Animal { public Snake() { Console.Writeline("Snake"); } } How many objects will be created in each of the following codes below? (Refer to the above code...) Animal myAni...