Hey guys...so I'm trying to brush up on my C threads and a question I've found is this:
Given a global variable int x = 0; implement the function void useless(int n) which creates n threads which in a loop increase x by 1, each thread terminates when x reaches 100.
I just don't have a handle on threads and need a solid example to base...
OMG. I have a little project to do and the Strings are killing me!
Now, I have a String which is null (is taken the value from invoking getParameter() from a servlet).
The problem is that, I'm trying to see if it's null, and, even if it's null, in the program is telling me that is not null, but later in program, when I'm using the vari...
i am having trouble when i try to get user input of an array..
this is my code!!!.
the problem is when i take input ..
it does not store that specific value..
for exapmle if i take inout 1.
it stores 48 and the while loop runs 3 time and then asks for the second input..
plz help!!
following is my code!!run it and tell wats wrong..
usin...
I have a homework assignment. I'm not looking for anyone to do the work for me, I'm just having trouble with one little aspect, although I'd accept advice on other bits as well.
The assignment is:
Write a class using a two-dimensional dynamic array.
The constructor passes in the dimensions of the array. The constructor also int...
I'm still working on a tiny parser for a tiny language defined in a task at school. The parser that generates an AST(Abstract syntax tree) is working. What I want is to check the defined variables, they must be bounded by the let expression. First the method that is defined in the task(suggestion, not needed):
checkVars :: Expr -> Char...
I am taking a database class and have to draw a bunch of different kinds of diagrams. Specifically, I need to draw ERD and dependency diagrams. The instructor does not want any hand drawn diagrams but does not offer any clue as to what software to use. Does anybody have any suggestions?
...
Hey guys,
I know in C you can use do-while for single integers and characters but I was wondering if it is possible to use the same do-while feature for whole groups of numbers?
EDIT: Okay i am really confused as to what this homework question is asking. But i think i get the question, just don't know what function will work. It wants...
Trying to make a swapNode function that can take any two nodes and swap them. I've made an algorithm that works if they're at least 2 nodes away, but I can't seem to come up with an algorithm that will work if they are closer to each other.
Here's what I wrote so far:
void swapNode(call * &head, call * &first, call * &second){
call...
Hello,
I'm building a short quiz where the user needs to input the meaning of an acronym.
This means I need to compare a long string (usually a sentence) typed in by the user with an acronym.
I have a feeling I'm not doing it right. For my testing I'm copy-pasting the correct answer to make sure the spelling is correct however I keep get...
Which method(s) can be used to ask the container to notify your application whenever a session is about to timeout?(choose all that apply)
A. HttpSessionListener.sessionDestroyed -- correct
B. HttpSessionBindingListener.valueBound
C. HttpSessionBindingListener.valueUnbound -- correct this is kind of round-about but ...
I am trying to come up with a method that takes an integer and returns a boolean to say if the number is prime or not and I don't know much C, anyone care to give me some pointers?
basically how i would do this in C# is like so:
static bool IsPrime(int number)
{
for (int i = 2; i < number; i++)
{
if (number % i == 0 && i ...
Hello, the C++ assignment im working on is to ask the user for a 4 digit number and then the program outputs all the possible vanity letters based on a phone keypad. I am currently stuck on the best way to get the program to work and how to write it. Anyone got any ideas? thanks for the help!
...
I have to make a program that uses C# Generated Graphics to make a replica of my name that I wrote in cursive. Twist is, I have to use Bezier Curves. I've already called a function to make Bezier Curves using 4 points and a gravity concept. My question to you is, What would be the easiest way to make around 10 curves.
Here is my functio...
I'm working on a problem set at college where were using c#. I have an array of integers (apologies first off if I don't know all the problem terms) and need to find the position in array of the maximum number (along with the minimum). I have it working but it doesn't seem a very good way to do it. Can anyone suggest a better way to achi...
How can you write the following statement in the given languages?
a(0) = 1
a_(n+1) = 1 - 1 / ( a_n + 3)
I need to find the smallest value of n when a_n -> 0.732050....
My attempt in Mathematica
a[(x+1)_] = 1 - 1/(a[x_] + 3)
The problem is apparently in this a[(x+1)_].
However, I do not know how to do it iteratively in Mathematica....
In Artificial Intelligence we studied the backtracking algorithm. Here is the pseudocode our book offers:
function backtrack;
begin
SL:= [Start]; NSL := [Start]; DE := [] CS := Start;
while NSL != [] do
begin
if CS = goal (or meets goal description)
then return SL;
if CS has no ch...
This is a homework question I got for my programming course at school, and I'm kind of lost, so please help. Here is the question:
Write an application program that
prints a diamond of asterisks (*) on
the screen. The number of lines in
the diamond is given by the user. As
an example, if the user requested a
diamond with ...
I am reading in pieces of a binary file using a FILE object in C++. Here is the fseek and corresponding fread call:
fseek(fp, startLocation, SEEK_SET);
fread(data, m_sizeOfData, 1, fp);
m_sizeOfData ends up being an integer greater than 400 thousand. This appears that it should read all 400 thousand+ bytes from the binary file into ...
The reason i ask this question is because i still get a null pointer exception even tho i am sure there is no issue but as usual there probably is some massive mistake i have made :D
The lecture slides said this
1) Use variables to store the start-index and length of the sequence of array elements that must contain Mike's entry if the...
Hi
I have been asked a question but I cannot even start to answer is so could some one give me an idea of were to start on how to possibly answer it ,
I am not looking for the answer just some teaching on how to answer it
here goes:
Assuming "regsister_globals" and "magic_quotes_gpc" are turned on, Whats wrong with this piece of c...