#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int twoify(int num, int times)
{
num *= 2;
if (times > 0)
{
times--;
return twoify(num, times);
}
return num;
}
int main()
{
srand(time(NULL));
const int BET = 1;
const int TIMES = 100000;
const int CHANCE = 50;...
A group diary and time management system is intended to support the timetabling of
meetings and appointments across a group of coworkers. When an appointment is to be
made that involves a number of people, the system finds a common slot in each of their
diaries and arranges the appointment for that time. If no common slots are available,...
hill(+IntList) succeeds if IntList consists of monotonically increasing integers followed by monotonically decreasing integers. For example, [1,2,5,8,11,6,3,-1] is a hill, but [1,2,5,8,11,6,9,3,-1] and [1,2,3,4,5,6] are not hills. You may assume that IntList contains only integers.
This is what i have done so far.
hill(List) :-
incr...
A petrol (gas) station is to be set up for fully automated operation. Drivers swipe their
credit card through a reader connected to the pump; the card is verified by communication
with a credit company computer; and a fuel limit is established. The driver may then take
the fuel required. When fuel delivery is complete and the pump hose i...
Welcome. I have a radix sorting method that uses an array to go through, but has to have another array (bin) that will store in an empty queue. I am confused as to how I would make a queue for the bins. I also have a findPlace method that finds the place of the each digit when called upon. So, here is what I got. Can someone help me find...
Hello,
Im trying to build an array based, "Binary Search Tree" by following the algorithm at:
http://highered.mcgraw-hill.com/olcweb/cgi/pluginpop.cgi?it=gif%3A:600%3A:388%3A%3A/sites/dl/free/0070131511/25327/tree%5Finsert.gif%3A%3ATREE-INSERT
Up until I need to realloacte, my tree resembles:
R
/
A
\
F
\
...
I'm given a yacc file and I'm supposed to create a symbol table. What do I do after I use yacc on the file?
...
Hi
I have got a html web page which gets a user input in the form of a directory path in a text box. I need to provide a validate button near the text box. on clicking the button, the user should get the feedback as to whether the directory path contains the required set of files, like few images and other files in certain format. Also ...
I have written a function for returning the next row in Pascal's Triangle given the current row:
pascal_next_row([X],[X]).
pascal_next_row([H,H2|T],[A|B]):-
pascal_next_row([H2|T],B),
A is H + H2.
I want to be able to find the nth row in the triangle, e.g. pascal(5,Row), Row=[1,5,1,0,1,0,5,1]. I have this:
pascal(N,Row):-
pa...
double sqrtIt(double x, double low_guess, double high_guess) {
int n = 10;
int num = 0;
while ( n > 0.000000000000001){
n = n / 10;
while (num < x && low_guess <= (low_guess * 10)){
low_guess = low_guess + n;
num = low_guess * low_guess;
}
}
return low_guess;
}
I've tried to use the code...
I already made a scanner, now I'm supposed to make a parser. What's the difference?
...
A question in my university homework is why use the one's complement instead of just the sum of bits in a TCP checksum. I can't find it in my book and Google isn't helping. Any chance someone can point me in the right direction?
Thanks,
Mike
...
I've been racking my brain trying to come up with a solution to this.
For a database class, I need to implement the following:
Table HUSBANDS: (Name Varchar2(10)) (Wife Varchar2(10))
Table WIVES: (Name Varchar2(10)) (Husband Varchar2(10))
and using Oracle constraints, enfore the following rules:
No two husbands can have the same na...
This is a rather simple question that has me stumped. How do you check for a particular value in an alphabetic field in COBOL 85? For example, I am using an EVALUATE statement to check for several possible values in an alphabetic field; depending on the value present, I will take one of several possible actions.
Basically, what I'm tr...
With assistance from others, I have a program that allows a user to input their employee name and number and then their hourly wage and their total number of regular hours and overtime hours. The program I need assistance with reads in that file, adds a new field at the bottom, "Gross Pay", and calculates the gross pay from the values fr...
Can anyone tell me how to write a C program to compare numbers(including negative numbers) without using logical operators?
...
Hi , Im designing a game on visual C# the game must contain two text boxes and two bottons and a lable
in the first text bos I should enter the range of numbers the program should randomly generate. ---- and its activated by the botton.
the second text box is the place where i enter the guesses ,---- also there is a botton to read the ...
I'm having a hard time understanding what I'm supposed to do. The only thing I've figured out is I need to use yacc on the cminus.y file. I'm totally confused about everything after that. Can someone explain this to me differently so that I can understand what I need to do?
INTRODUCTION:
We will use lex/flex and yacc/Bison to genera...
Hi folks,
I'm currently writing a 32Bit ALU (Add/Sub) in VHDL. I've got a problem with the overflow bit.
I can't see when to set the overflow depending on the operation (addition, subtraction) and the input values.
Can you help me ?
best regards,
Andre
...
Can I use malloc to add symbol table entries? How do I traverse the table to check if something is already there?
...