homework

Converting an integer Into a List?

Hi, i am currently trying to convert an integer into a list. E.g. 1234 => List composed of 1, 2, 3, 4 I have this: (string->list (number->string 1234)) Unfortunately it adds #'s and \'s to it. I am guessing this is a string representation of a number. How can i remove these symbols. Since i need to reorder the integers, and print o...

How do you run your own code alongside Tkinter's event loop?

My little brother is just getting into programming, and for his Science Fair project, he's doing a simulation of a flock of birds in the sky. He's gotten most of his code written, and it works nicely, but the birds need to move every moment. Tkinter, however, hogs the time for its own event loop, and so his code won't run. Doing root.ma...

Can someone explain the output of this program?

Can someone please explain why this program outputs 0x00000004? class AndAssignment { static void Main() { int a = 0x0c; a &= 0x06; Console.WriteLine("0x{0:x8}", a); } } /* Output: 0x00000004 */ ...

Understand the shift operator

/* I can not understand this operatore (c# reference) */ class MainClass1 { static void Main() { int i = 1; long lg = 1; Console.WriteLine("0x{0:x}", i << 1); Console.WriteLine("0x{0:x}", i << 33); Console.WriteLine("0x{0:x}", lg << 33); } } /* Output: 0x2 0x2 0x200000000 */ class Ma...

How to resolve a Stream Closed Error in java?

Hello, I am really thankful for everyone who would read this and try to help me, the following is the code I am trying to write for a server class for a socket-programming project for college: import java.io.*; import java.net.*; import java.io.File; class Server{ public static void main (String[]args)throws IOException{ Serve...

Java: Knuth shuffle on a Stack?

Hi, For a programming class I am creating a blackjack program for the first homework assignment. The professor has given us a sample Card class, which includes the method to add them to a deck. For her deck, she uses an ArrayList, which you can easily Knuth Shuffle with the Collections.shuffle() method. That method does not work for St...

Per version (1.0,1.1,2.0,3.0,3.5) how many classes are in the .NET framework?

Per version (1.0,1.1,2.0,3.0,3.5) how many classes are in the .NET framework? I am looking for the info for a presentation that I'm going to give for a class in my Master's program. ...

Subtract from an input appended list with a running balance output

Noob I am trying to write a script that gives a running balance. I am messing up on the elementary declared functions of python. I need it too: accept a balance via input append a list of transactions take those out one by one in the order they were input print a running total use pyhtmltable to make the output in html table rea...

SQL questions

I have a table A ID Term 10 A 10 B 10 C 20 A 20 B 20 E what's the best way to write a sql to - get ID 10, if I try to find (A,B,C) - get NOTHING if I try to find (A,B) - get ID 20, if I try to find NOT in (C,D) Select distinct ID from TableA where Term in (A,B,C) will return both 10 and 20 Select distinct I...

Converting C-DES-implementation to Java - Help needed

Hi, I'm a German student an for computer classes I need to implement the DES-encryption in Java(by myself, not by using the Java-API) and explain it in detail. I didn't find any Java-code-examples using google, however I did find an easy implementation in C(I do not know C, I know a little C++, but not that well, pointer still get me now...

Comparing two integers without any comparison

Is it possible to find the greatest of two integers without any comparison? I found some solutions: if(!(a/b)) // if a is less than b then division result will be zero. { cout << " b is greater than a"; } else if (!(a-b)) // we know a is greater than or equal to b now. check whether they are equal. { cout << "a and b are equa...

Predefined squareroot function without using sqrt() from math.h in C

Homework question: Cygwin GNU GDB Cygwin GNU GCC Attempting to establish the length of the hypotenuse C from the square root of A power of 2 and B power of 2. Example input: Enter the length of two sides of a right-angled triangle: 2.25 8.33 Answer: The length of the hypotenuse is: 8.628523 Question: when I specify the same i...

Expression Evaluation in C++

Hi, I'm writing some excel-like C++ console app for homework. My app should be able to accept formulas for it's cells, for example it should evaluate something like this: Sum(tablename\fieldname[recordnumber], fieldname[recordnumber], ...) tablename\fieldname[recordnumber] points to a cell in another table, fieldname[recordnumber] poi...

What are the challenges you have faced in writing integration tests?

What are the challenges you have faced in writing integration tests? Does writing unit tests help in writing integration tests? ...

New to Java - Converting to Binary, Counting 1's, Recursive

Hey Everyone I just started Data Structures and Algorithms which is taught in Java. So far I've only learned C++ in my life so I'm still VERY new to using java. Anyways I have a homework problem I'm a little stuck on: Write a recursive method that returns the number of 1's in the binary representation of N. Use the fact that this is e...

Broken pipes in C -- pipe(), fork(), exec() program

Hello, I need to write a simple program: There will be a Parent and a few programs [children] (started via execl in Parent). Children communicate to one another in this way: Child I sens to Parent number J, Parent sends a message (something like -- "there is a message to you") to J, J send to Parent number K etc. etc. And there is a pr...

How can I build a recursive function in python?

How can I build a recursive function in python? ...

Access to Compiler's errors and warnings

i'm developing a simple C# Editor for one of my university courses and I need to send a .cs file to Compiler and collect errors (if they exist) and show them in my app. In other words i want to add a C# Compiler to my Editor. Is there anything like this for the debugger? ...

Modifying C string constants?

I want to write a function that reverses the given string passed into it. But, I can not. If I supply the doReverse function (see code below) with a character array, my code works well. I can't figure out why this does not work. I am able to access str[0] in doReverse, but I can't change any value of the array by using a char pointer. A...

How can i convert hex numbers to binary in c++?

I am taking a beginning c++ class, and would like to convert letters between hex representations and binary. I can manage to print out the hex numbers using: for(char c = 'a'; c <= 'z'; c++){ cout << hex << (int)c; } But I can't do the same for binary. There is no std::bin that I can use to convert the decimal numbers to binary. H...