Ok, so my assignment is to build on an existing code from the book. I have to add the 3rd box and then calculate the total for all 3 boxes. Here is what I've written so far, but it will not compile. Please help me find the problem. Thanks.
The program I'm using is MS Visual C++ and the complile error I get is "error C2447: '{' : missing...
There is a VERY similar question to mine but in my case I don't have any duplicate jars in my build path, so the solution does not work for me. I've searched google for a couple of hours now, but none of the solutions I've found there actually resolve my issue. I'm creating a web site with some database connectivity for a homework. I'...
I'm unaware of the mathematics in this algorithm and could use some help.
Algorithm:
if n<2 then
return n
else return fibonacci(n-1) + fibonacci(n-2)
Statement
n < 2 is O(1)
Time n >=2 is O(1)
Return n is O(1)
Time n>=2 is -
Return fib(n-1) + fib(n-2) is -
and time n>=2 is T(n-1) + T(n-2) +O(1)
Total: ...
How would I approach creating a process hierarchy that would look like a balanced ternary tree of depth N? ... meaning each process has 3 children so there would be (3^N-1)/2 processes in a tree of depth N. To create the new processes, I only want to use fork().
This is what I have so far but I don't think it works because I don't deal...
I posted this earlier and it got closed because I did not show my try at coding it, so here is the question:
SECTIONS
$160 = section 1
$220 = section 2
$280 = section 3
$350 = section 4
$425 = section 5
Develop pseudocode that accepts as input the name of an unspecified number of masqueraders who each have paid the full cost of their ...
Your Java solution should have a single command-line argument representing the number of candidates.
I am having trouble understanding the homework question.
...
Hi!
I’m going to explain to you in details of what I want to achieve.
I have 2 programs about dictionaries.
The code for program 1 is here:
import re
words = {'i':'jeg','am':'er','happy':'glad'}
text = "I am happy.".split()
translation = []
for word in text:
word_mod = re.sub('[^a-z0-9]', '', word.lower())
punctuation = word[-...
Hey guys,
I went out and bought a copy of the Dragon Book (second edition) but most of the exercises don't seem to have answers. Any idea where I can get them?
Edit: Couldn't find solutions anywhere. Also, further research revealed that the gradiant quesions/answers do not match those in the book.
Therefore you guys will probably see ...
I have an assignment where I have questions that ask for the following implementations:
insertAtRanks(Integer x, Integer y, Object o): insert a new element to be stored at position (x,y)
and
Object removeAtRanks(Integer x, Integer y): remove and return the element at position (x,y)
It already asked for the implementation of repla...
I'm a newbie and i need to know how to modify a password guessing program to keep track of how many times the user has entered the password wrong. If it has been entered more than 3 times then it should print " This seems to be complicated" and the program should be ended.
The password guessing program is
password="abcd"
while password ...
Begin
Fail = 0
Pass = 0
Read Mark
While Mark is > < = Do
If Mark > 50 then
Pass = Pass + 1
Else
Fail = Fail + 1
EndIf
Read Mark
EndDo
Total = Pass + Fail
Print "No. Of Students Who Pass",PASS
Print "No. Of Students Who Fail",FAIL
Print "No. Of Students Taken The Exam",TOTAL
End
...
// Huffman Tree.cpp
#include "stdafx.h"
#include <iostream>
#include <string>//Necessary to do any string comparisons
#include <fstream>
#include <iomanip>
#include <cstdlib>//for exit() function
using namespace std;
class BinaryTree{
private:
struct treenode{
char data;
int weight;
treenode *LChild;
...
Okay I have updated my code a little, but I am still not exactly sure how to use the vector of command line arguments that I pass. I tried to set it up like the code I have below, but it wont compile. It gives me the error that it cannot find argc and argv:
1>c:\users\chris\documents\visual studio 2008\projects\cplusplustwo\cplusplustwo...
I have a cd , dvd. book media program. Currently, i am trying to add book information to a set. I am getting a nasty crash.
error: Unhandled exception at 0x00449d76 in a04xc.exe: 0xC0000005: Access violation reading location 0x00000014.
So, obviously its trying to access memory its not suppose to? just not sure why or what i need to d...
Hi all,
I've never used MIPS assembly before and it was just introduced in class. I'm working on a homework assignment, but I'm having some difficulty calling a function. Here's what I've worked out so far:
.data
.align 2
matrix_a: .word 11, 23, 31, 46, 52, 66, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
.text
....
hii to all
I m doing a final year project on data extraction from an image
for that purpose i want to know how,
can I compare two images pixel by pixel in java
can any body give me answer plz its important to me
also code plz if possible
and i also want to extract data from image in editable form
...
Suggest a easy way to read the contents of a file in a string and display the contents using objective c language.
for example if there is an source.rtf file which contains
[name]lohith[/name]
[age]22[/age]
The program shld read the contents of this file into NSString object and display the contents in the following format:
name=...
This is from a class assignment:
This program is about listening to colors. We will treat pictures as piano scores.
Write a function called listenToPicture that takes one picture as an argument. It first shows the picture. Next, it will loop through every 4th pixel in every 4th row and do the following. It will compute the total of the ...
ifstream inStream;
inStream.open(filename.c_str(), fstream::binary);
if(inStream.fail()){
cout<<" Error in opening file: "<<filename;
exit(1);
}
Let's say we just want to deal with individual bits from the file. I know we can read the file char by char, but can we read it bit by bit just as easily?
...
I'm working on a homework project and I'm supposed to perform a database query which finds flights either by the city name or the airport code, but the flights table only contains the airport codes so if I want to search by city I have to join on the airports table.
The airports table has the following columns: code, city
The flights ta...