homework

Find two of the same character in a string with regular expressions

This is in reference to a question I asked before here I received a solution to the problem in that question but ended up needing to go with regex for this particular part. I need a regular expression to search and replace a string for instances of two vowels in a row that are the same, so the "oo" in "took", or the "ee" in "bees" and ...

C++ error C2065: 'cout' : undeclared identifier

!!!!solved!!! - VS2010 has a bug, works fine with eclipse Galileo I am working on the 'driver' part of my programing assignment and i keep getting this absurd error - error C2065: 'cout' : undeclared identifier I have even tried using the std::cout but i get another error that says: IntelliSense: namespace "std" has no member "cout...

Haskell IO with Numbers

Can anyone help with this exersise? Write a program which asks the user for the base and height of a right angled triangle, calculates its area and prints it to the screen. The interaction should look something like: The base? 3.3 The height? 5.4 The area of that triangle is 8.91 Solved with: getTriArea :: IO Float get...

Multiplying two number arrays

Can anyone please tell me how to multiply two number arrays in C? The number arrays are basically derived from two strings containing digits. eg: 123456 and 132465. Edit: I had two string as S1 = "123456" and S2="132546". I then converted these two strings into array of ints i.e. int IS1[6] and IS2[6] so that IS1[1] = 1, IS1[2] = 2......

Help with writing a void reverse() method and use recursion to reverse a complete sentence(Java).

I already wrote something that removes the first character of a string and puts it after the remaining substring and then prints it out, the instructions were to reverse the sentence using recursion by removing the first letter of the sentence and concatenate it to the reversed remaining substring, ie. "Hello" yields "olleH". But i dont ...

Javascript file- is function in error? Need help!

I am trying to see if my JavaScript file's function is written correctly in order to display "Sunday, December 24, 2006". So here is the function: function XmasDays(thisDate) { var XMYear = thisDate.getFullYear(); var XMDay = new Date("December, 25, 2005"); XMDay.setFullYear(XMYear); var dayTotal = (XMDay-thisDat...

Modelling a Finite Deterministic Automaton via this data *Edit with new code*

I have this input file: 2 3 2 1 ab 1 0 2 0 2 0 2 0 3 abaa aab aba 3 3 2 ade 0 1 2 1 2 0 2 1 0 1 2 2 2 a de The first line represents the number of test cases. Each test case starts with 3 integers, the first is the number of state for the automaton, next is the number of symbols in the alphabet and then the number of final states. ...

How to use PORT command while writing an FTP client with JAVA

I am trying to write an FTP client using java. As far as I understand I need to send my IP adress with PORT command when I need to establish an active connection but, How do I get that IP address? I am trying to do something like this but it is obviously wrong: ServerSocket ssock = new ServerSocket(); ssock.bind(null); ssock.ssock.get...

Memory management in C

Suppose I have a structure, and a pointer to a memory location p, how do I make sure that while creating an instance 'a' of the structure, it is placed into a memory chunk starting at p? So I am passed a chunk of memory and I want to create a node at the beginning of it, so I need to make sure that the node is created at the beginning o...

C pointer arithmetic for 2D arrays

// strings is a 2D array (each string is 11 bytes long) char strings[][11] = {"0123456789", "2222244444", "3333366666"}; printf("String 3 Character 2 is %c\n", strings[2][1]); How can I code this print statement using pointer arithmetic instead of the strings[2][1] ? ...

C++ static member functions and their scope

I have two questions. In C++, a static member function has direct access to a public non-static data member defined in the same class? False In C++, a non-static member function has direct access to a private static data member defined in the same class? True My note say false for the first question and true for the second one. I jus...

How to design this "bus stations" database?

I want to design a database about bus stations. There're about 60 buses in the city, each of them contains these informations: BusID BusName Lists of stations in the way (forward and back) This database must be efficient in searching, for example, when user want to list buses which are go through A and B stations, it must run quickly...

How to write a binary algorithm for C/C++

I am having trouble to write the binary algorithm in C/C++. My question is like that: Apply binary algorithm to search for a number from 1 to 100 in a number guessing game. The user will respond with 'y' for a correct guess, 'h' if the guess is too high or 'l' if the guess is too low. I don't have any idea to apply it. Can someone ju...

writing LZW program in matlab

hello i'm writing LZW in matlab,but i don't know how i should make dictionary? i want some help in writing program. thanks ...

Homework: Java IO Streaming and String manipulation

In Java, I need to read lines of text from a file and then reverse each line, writing the reversed version into another file. I know how to read from one file and write to another. What I don't know how to do is manipulate the text so that "This is line 1" would be written into the second file as "1 enil si sihT" ...

Homework: no subquery in getting a value indirectly

I'm having a hard time creating a query for smth that sounds like this: what is the name and color of the items that cost more than grey box detergent(2 attributes: color:grey, type:detergent). NOTE: I'm NOT allowed to user subqueries or use the price as a constant. using subqueries I managed to get this: SELECT name, color FROM i...

How do I overload the I/O operators C++ (edited again)? Can anyone plz help?

I have created a class that allows the user to input their mailing address, order date, type of cookie ordered and the quantity. There were other errors, but I stayed late and with the assistance of my prof, I have fixed them. Now all that is left is that I need to be able to change code to overload the I/O stream operators so that the o...

Homework: can you help me to answer for this question about array?

Suppose that temperature measurements were made on 7 days of 2009 in each of 5 cities .write a program that will read the city name followed by the temperature measurements of that city.The city name and measurements should be stored in two array .The program should find out the average temperature of each city.Also you should find the ...

SQL check when creating a table

Is it possible to have a CHECK under the form: CREATE TABLE abc (no INTEGER, det INTEGER NOT NULL, quo INTEGER CHECK (quo < AVG(st.quo)), qoh INTEGER CHECK (qoh >= 0)); So basically every time new values are entered to check the average of quo of another (existing) table in the database and if and only if it's lower than the average...

Homework: binary tree - level-order trasversal

hi, is there a way to visit a binary tree from the lowest level to the higher (root) ? not from the root-level to the lowest!!! (and not using the level-order traversal and a stack...!!!) <--- its opposite.. so difficult...thank you! ...