I was having some problems with my first C++ program (this one) awhile ago. Basically I am trying to do an assignment for intro to C++ class where the professor has taught us no syntax. Here is my code right now:
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <string>
using namespace std;
class Race
{
public:
...
Hello, for a homework assignment I was given a Card class that has enumerated types for the Rank and Suit. I am required to compare two pokerhands (each hand is an ArrayList of 5 cards) and decide the winner.
The isStraight() function is really bothering me, because I have to start over the count after the Ace. For example,
QUEEN, KING...
For my Programming 102 class we are asked to deliver C code that compiles and runs under Linux. I don't have enough spare space on my hard drive to install Linux alongside Windows, and so I use cygwin to compile my programs.
The most recent program I had to give in compiles and runs fine under cygwin. It compiles fine under Linux, but h...
In a graph, every node is connected with every other node, with no redudant connections.
That is, if A->B then B doesn't need to go to A. It is still one connection.
I know that there are N * (N - 1)/2 Edges.
In a loop, it would look like,
for(int i = 0; i < n - 1; i++)
for(int j = i + 1; j < n; j++)
I can't remember the for...
I have an assignment from my comp. system org. subject and unfortunately I'm kind of new when it comes to assembly language. I'm supposed to write a program that displays the numbers 0,2,4,6,8,10 respectively. How would I go about this?
Maybe this'll answer my question: (Reactions please)
.model small
.stack 100H
.data
.code
call proc...
For a project in C, we need to build a shell over a Unix server.
It needs to be able to execute functionality native to Unix, and not bash (or any other Unix shell).
I am writing a method in the hopes to generalize a call to a command. into a general function:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wa...
Hi,
I'm trying to write part of a J2ME application and I'm responsible for reading NMEA data from a GPS device attached via bluetooth (to a Dell Axim X51 PDA).
I've paired the gps device with the PDA and I can run the sample program that comes with the gps device and it succesfully streams NMEA strings.
In system settings, in GPS set...
I'm trying to use Taylor series to develop a numerically sound algorithm for solving a function. I've been at it for quite a while, but haven't had any luck yet. I'm not sure what I'm doing wrong.
The function is
f(x)=1 + x - sin(x)/ln(1+x) x~0
Also: why does loss of precision even occur in this function? when x is close to zero, s...
I am using the following query to insert values into one field in table A.
insert
into A (name)
values ('abc')
where
A.id=B.code
and B.dept='hr' ;
Is this query right?
If not, please provide me a correct way. It's really urgent. Thanks in advance.
...
Hey, I am so close to fininshing my guess a number game, very simple in PHP, but for some reason I am stuck. I am storing the variable in a hidden form, but obviously each time the page is sent it resets the number so you can never get the right one.
Any ideas? My code is below.
<?php
// generate a random number for user to guess
$numb...
For this university assignment that I have been assigned.
I have to develop an application for use on a PDA which is running J2ME and Apache Derby in embedded mode.
I would like to both import/export an image to the database. How would I do this? Also would storing the image as a blob be suitable?
Thanks in advanced.
...
This is not a homework problem... I'm studying on my own. If someone could explain to me what is going on here and how to solve this problem it would be greatly appreciated.
Suppose relation R(A,B) has the tuples:
A B
1 2
3 4
5 6
and the relation S(B,C,D) has tuples:
B C D
2 4 6
4 6 8
4 7 9
Compute the natural join of R and S....
The table Arc(x,y) currently has the
following tuples (note there are
duplicates):
(1,2),
(1,2),
(2,3),
(3,4),
(3,4),
(4,1),
(4,1),
(4,1),
(4,2)
Compute the result of the query:
SELECT a1.x, a2.y, COUNT(*)
FROM Arc a1, Arc a2
WHERE a1.y = a2.x
GROUP BY a1.x, a2.y;
What are a1 and a2 referring to?
...
I have this but there is an error, I don't get it :(. I'm relatively new to Java.
package hw;
import java.util.Scanner;
public class Problem1
{
public static void main (String [] args)
{
int cost; int number; double cost_unit; double total;
Scanner entrada = new Scanner(System.in);
System.o...
Hi,
I'm new at openCV programming, and my final project requires I use Background Subtraction, however I am having trouble understanding it.
I would appreciate any help in understanding it, as it is urgent.
i mean, can anybody explain the algorithm of it and could you send me the program??
please.........
...
Greetings again, and thanks once more to all of you who provided answers to the first question. The following code is updated to include the two functions per the assignment.
To see the original question, click here.
I am pretty sure this fulfills the requirements of the assignment, but once again I would greatly appreciate any assist...
Hi guys, I'm working on a homework question and I've got the answer, but I'm not sure if the terminology I'm using is correct and I was hoping if someone can clarify. Here's the situation:
I have a graph in the shape of a rectangle of size M x N. The node at (0, 0) has no incoming edges. All other nodes have incoming edges from the nort...
What is the complexity of:
int f4(int n)
{
int i, j, k=1, count = 0;
for(i = 0; i < n; i++)
{
k *= 3;
for(j = k; j; j /= 2)
count++;
}
return count;
}
I know it is O(n^2) but how do you calculate this? and why isn't it n*log n?
...
Hi guys, I'm studying for my operating systems midterm and was wondering if I can get some help.
Can someone explain the checks and what the kernel does during the open() system call?
Thanks!
...
I am in the process of writing a blackjack code for python, and i was hoping someone would be able to tell me how to make it:
Recognize what someone has typed i.e. "Hit" or "Stand" and react accordingly.
Calculate what the player's score is and whether it is an ace and a jack together, and automatically wins.
Ok, this is what i have ...