homework

Permissions problem after SP1 on SharePoint Server

You do not have permissions to do this operation. Ask your website administrator to change your pemissions and then try again, or log on with another account that has this permission. To log on with another user account click ok. I need some help regarding the above error. After applying SP1 pack on our SharePoint Server...

Python recursive function error: "maximum recursion depth exceeded"

I solved Problem 10 of Project Euler with the following code, which works through brute force: def isPrime(n): for x in range(2, int(n**0.5)+1): if n % x == 0: return False return True def primeList(n): primes = [] for i in range(2,n): if isPrime(i): primes.append(i) retu...

Get the closest number

Hi, i am implementing a little Black Jack game in C# and i have the following problem calculating the player's hand value. the problem is Ace may have value of 1 or 11 so if the players has three cards and one Ace if the sum of the cards is <= 10 Ace will have value of 11(Sorry for who doesn't know the scope of the game is to reach 2...

Fread binary file dynamic size string

I've been working on this assignment, where I need to read in "records" and write them to a file, and then have the ability to read/find them later. On each run of the program, the user can decide to write a new record, or read an old record (either by Name or #) The file is binary, here is its definition: typedef struct{ cha...

fgets and strcmp [C]

I'm trying to compare two strings. One stored in a file, the other retrieved from the user (stdin). Here is a sample program: int main() { char targetName[50]; fgets(targetName,50,stdin); char aName[] = "bob"; printf("%d",strcmp(aName,targetName)); return 0; } In this program, strcmp returns a value of -1 when ...

47 memory leaks. STL pointers.

I have a major amount of memory leaks. I know that the Sets have pointers and i cannot change that! but clean up the mess i have... I am creating memory with new in just about every function to add information to the sets. here is my potential leaks.. library.cpp #include "Library.h" #include "book.h" #include "cd.h" #include "dvd.h"...

What's wrong with this conditional?

I am trying to make a method that tests to see if 3 lengths can make a triangle. I think i'm making some kind of syntax error but i can't figure out what it is. Here is the relevant bit of code: (its in java) public static void trya (int a, int b, int c) { if (c>(a+b)) { System.out.println ("yes") ; } else ...

C++ class with char pointers returning garbage

I created a class "Entry" to handle Dictionary entries, but in my main(), I create the Entry() and try to cout the char typed public members, but I get garbage. When I look at the Watch list in debugger, I see the values being set, but as soon as I access the values, there is garbage. Can anyone elaborate on what I might be missing? #...

How to skip integers in C++ taken from a fstream txt file?

I need to create a function that uses a loop. This function will open a text file and then must be able to skip a variable number of leading random integers. The program must be able to handle any number of leading random integers. Example if the opened file reads this on its first line: 100 120 92 82 38 49 102 and the SKIP_NUMBER va...

A textbox class only accept integers in Java

I just want to do a textbox class only accepts integers.. I have done something, but ı think it's not enough. Can anyone help me, please? Thanks... import java.awt.TextField public class textbox extends TextField{ private int value; public textbox(){ super(); } public textbox(int value){ setDeger(val...

binary search question

For binary search, what is the average number of comparisons needed to find a record in a file? ...

sequential search homework question

Consider a disk file containing 100 records a. How many comparisons would be required on the average to find a record using sequential search, if the record is known to be in the file? I figured out that this is 100/2 = 50. b. If the record has a 68% probability of being in the file, how many comparisons are required on average? This ...

What is an overloaded operator in c++?

I realize this is a basic question but I have searched online, been to cplusplus.com, read through my book, and I can't seem to grasp the concept of overloaded operators. A specific example from cplusplus.com is: // vectors: overloading operators example #include <iostream> using namespace std; class CVector { public: int x,y; ...

Replace use of explode() with str_split()

$transData = fgets($fp); while (!feof ($fp)) { $transArry = explode(" ", $transData); $first = $transArry[0]; $last = $transArry[1]; $Sub = $transArry[2]; $Grade= $transArry[3]; echo "<table width='400' ><colgroup span='1' width='35%' /><colgroup span='2' width='20%' /> <tr><td> ".$first." ".$last." </td><td> ...

Read from cin or a file

When I try to compile the code istream in; if (argc==1) in=cin; else { ifstream ifn(argv[1]); in=ifn; } gcc fails, complaining that operator= is private. Is there any way to set an istream to different values based on a condition? ...

help in security assignment

i have to write a program that sniffs network packets (part1-the simple part). and i have to update the program (part2) so that it will be able to terminate connections. the specific requirements are: construct raw packets by specifying data link layer and network layer information including appropriate source and destination MAC and IP ...

[Homework] Online programming editor

Hi, For a school project i need to write or use a online programming editor. It is a part of a bigger project. I thought of a java application, php/html/javascript or flash. I have a couple of things i could do: Find a good working application and edit it so it works with the rest of the project Find good parts for a editor and make ...

Inserting into a Binary Tree which uses void* in C

I have to create a binary tree using the struct as follows: struct treenode; typedef struct treenode* TreeNode; struct treenode { void* data; TreeNode left, right; }; using void* as the type for the data to be stored at each leaf, so that an object of any type can be inserted into the tree. When I am inserting a new leaf, I have to...

Asymptotic runtime behavior

how can I can find the asymptotic runtime behavior of any algorithm? ...

Looking for some input on my C++ program. Simpletron, Machine language.

Edit: So, seems I do have a problem somewhere in my coding. Whenever I run the program and input a variable, it always returns the same answer.."The content at location 76 is 0. Okay guys, I posted on here a few days ago about a question but it was just a compilation error, so if this looks familiar, thats why. I will reiterate, I'm new...