homework

c assignment, averaging integers

I worked on this yesterday about 5 hours and got the code to work using help from this site, but I think the way I did it was a cheater way, I used a scanf command. Anyways I want to fix this the correct way. Thanks guys! Oh the code compiles but the average that gets spit out is wrong. I would like to conceptually understand what I ...

Problems initializing pthreads

Hi, I'm debugging a program using pthreads for a class I have to solve a producer consumer problem. What I'm running into is that I get an error saying that I have a undefined reference to the create a join functions. After that I put the initialization functions in but now I get the error that none of them were declared within the scop...

I want a function that reads in a file and returns the sum of ascii values

I want a function that reads in a file and returns the sum of ascii values. I have looked at this page: http://stackoverflow.com/questions/1292630/how-to-open-a-file-and-find-the-longest-length-of-a-line-and-then-print-it-out/1292676#1292676 and the answer to my question was probably starring me in the face, but I cant follow the cod...

C#: Split a string (or user input) into individual characters withOUT using an array?

Ok here's what im trying to do. The user is prompted to enter an 8 digit number (7 numbers plus a hyphen 781-0432 I want it to break it apart and store it into 8 separate char variables without using an array: a = 7 b = 8 c = 1 ... h = 2 Ive been trying to do it with the Console.Read() method: a = Console.Read(); b = Console.Read();...

Haskell: Polymorphic functions explanation

So i am given this intCMP :: Int -> Int -> Ordering intCMP a b | a == b = EQ | a < b = LT | otherwise = GT intCMPRev :: Int -> Int -> Ordering intCMPRev a b | a == b = EQ | a < b = GT | otherwise = LT floatCMP :: Float -> Float -> Ordering floatCMP a b | a == b = EQ | a < b = LT | otherwise = GT ...

Simple Java Loop Question

Assume that the int variables i and j have been declared, and that n has been declared and initialized. Using for loops (you may need more than one), write code that will cause a triangle of asterisks of size n to be output to the screen. For example, if the value of n is 4, the output should be * ** *** **** ...

C++ cannot instantiate abstract class

I am new to C++. Could you pls help me get rid of the errors: error C2259: 'MinHeap' : cannot instantiate abstract class IntelliSense: return type is not identical to nor covariant with return type "const int &" of overridden virtual function function template <class T> class DataStructure { public: virtual ~DataStructure...

problems using a class template

i created a template that contains a map. when i try to create an instance of that template i encounter a linking problem with the constructor and destructor. also, when i try to create an instance in main it skips the line while debugging, and doesn't even show it in the locals list. it doesn't compile "DataBase db;" unless i add "()" a...

How can I determine to which C standard is this code compliant?

In a C lab this uber simple code appears: #include <stdio.h> int suma (int a, int b) { return a+b; } int mult (int a, int b) { return a*b; } int main(void) { int a,b; printf ("Operando 1: "); scanf("%d",&a); printf("Operando 2: "); scanf("%d",&b); printf("%d+%d=%d\n",a,b...

A simple sql query question.

suppose I have a table like this: table1: name favorite_music a country b rock a jazz b jazz How can I do this query: find the names whose favorite_music style has both "country" and "jazz". For the example above, it should be only "a". ...

How to return the time, which would take for a method to finish it's job?

I have a simple recursive algorithm, which returns Fibonacci numbers: private static double fib_recursive(int n){ if(n <= 2) return 1; else return fib_recursive(n-1) + fib_recursive(n-2); } Now my task is to return the time, which this method would take to calculate the 400-th fibonacci number on a given computer e.g. fib_recu...

How to fix a linking bug?

hey, sorry for this but i'm trying to figure out what's the problem for too long, if you can spot a clue from this long error message i will be thankful Error 6 error LNK2019: unresolved external symbol "public: __thiscall Adjutancy::Adjutancy(class std::set<class Vehicle *,struct CompareCatId,class std::allocator<class Vehicle *>...

Can you return a value in Scheme that won't be printed in a list?

I'm trying to return an invisible value in a scheme function, but can't seem to get anything that WONT be printed to the screen, which is what I need. Is there a value in scheme that can be added to a list which won't be printed in a (display) call? ...

Error fixing ASSIGNMENT. still above my head (updated code)

First of all this is homework. I have been trying to get rid of the errors and usually screw the code up farther and end up coming back to the original code. If you could please give me some direction (in terms I can understand) I would really appreciate it. I do not think our instructor actually expects us to get it, but I still have...

Help making a singly linked list in Java

Hi all, This is for homework but please know that I have looked online for help (such as http://www.sethi.org/classes/class_stuff/cis435/others/notes-java/data/collections/lists/simple-linked-list.html) and my textbook but I am still having some issues. Any help would be appreciated... Right now I'm trying to just insert values in but...

findString program python

I have an assignment said that to create a findString function that accept 2 string which are 'target' and 'query', and that returns 
a 
list
 of 
all 
indices 
in 
target
 where 
query 
appears. 
If 
target 
does 
not 
contain 
query,
return 
an 
empty
 list.
 For example: findString(‘attaggtttattgg’,’gg’) return: [4,12] I dont kno...

Python programming

My assignment ask to make a function call readFasta that 
accepts 
one 
argument:
the
 name 
of 
a
 fasta
 format 
file
(fn) 
containing 
one 
or 
more 
sequences.
The 
function 
should 
read
 the 
file 
and
 return 
a
 dictionary 
where 
the 
keys 
are 
the 
fasta 
headers 
and 
the 
values
 are 
the 
corresponding 
sequences 
from 
f...

C Homework, Print out the binary value of an integer

#include <stdio.h> #include <stdlib.h> // Print out the binary value of an integer void binval (int num); int get_number(); main () { int num; num = get_number(); printf("Num = %d\n",num); binval(num); } void binval (int num) { int val = 0; int test; if (!num) { printf("\n"); return; } test = num & 0x...

print a 5 digit number to words using c#

Possible Duplicate: How can I convert an integer into its verbal representation? Consider i have a 5 digit number say 45456 and i want to print it as Forty five thousand four hundred and fifty six using c#. Any suggestion. ...

Having issues with some homework, C programming stuff.

So the problem is to add 3 numbers together(2's complement) in C. Normally should be very simple, but the hard part of this problem is that you can only use the ops ! ~ & ^ | << >>, no kind of loops, or function calls, or anything fancy. Just those ops. He gives us a function that adds 2 words together. The return of the function I'm...