## mojo666's Profile User Rating:

Reputation: 397 Architect
Group:
Expert
Active Posts:
856 (0.34 per day)
Joined:
27-June 09
Profile Views:
14,035
Last Active:
Apr 14 2016 02:58 PM
Currently:
Offline

### Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Mozilla
Favorite Processor:
Who Cares
Favorite Gaming Platform:
PC
Who Cares
Dream Kudos:
0
Expert In:
Computer Science

### Latest Visitors

mojo666 has not set their status

1. #### In Topic: Determining if a number is prime using recursion.

Posted 14 Apr 2016

The main issue with your code is that you are hard coding the divisor. You need to check every number less than n to see if it is a potential divisor. As written, you only check 3 and 2.
2. #### In Topic: How can I find the array Duplicates?

Posted 30 Mar 2016

Quote

Is that really easier than adding a for statement, an if statement, a decrement and 2 breaks?

I don't think your decrementing idea will require that much extra stuff, but my suggestion can be accomplished by adding one if statement and modifying the existing condition. In fact I believe your decrement idea can be accomplished by just adding one extra if statement.
3. #### In Topic: How can I find the array Duplicates?

Posted 30 Mar 2016

Your code counts all extra occurrences of non-unique values. When "i" gets to the second occurrence, onecountermax has been reset so your program doesn't know that it has already counted these occurrences. Thus, since there are 3 occurrences of "4" it will output 2. Probably the easiest way around this is to create a boolean array the same size as your number array and mark off locations that you have already counted.
4. #### In Topic: SQL And Declarative Thinking

Posted 24 Mar 2016

Quote

The following code answers the question: Which horses are ridden by all persons?

The English translation of the code is "select all horses where there isn't a rider that isn't riding that horse".

Yes it will have to iterate over every horse to test the condition. That doesn't make it any less declarative.
5. #### In Topic: What is the difference between return 0 and return 1 in a function?

Posted 3 Mar 2016

Maybe it will help to see the function in action?

```if(find_space(myString)==1) //if the return value of the function is 1 then there is a space.
{cout<<"there is a space in your string"<<endl;}
else
{cout<<"the string has no space"<<endl;}
```

You can change the function to return anything you want. It is all dependent on how you want to use the function. The rest of your code will just be adjusted to interact with the values the function is expected to return.

### My Information

Member Title:
Age:
31 years old
Birthday:
July 23, 1984
Gender:
Interests:
Chess, math, computers, AI
Years Programming:
6
Programming Languages:
C++, C#, VB.net, SQL, OCAML, LISP, MIPS

E-mail:
Private
Website URL:
http://

### Friends

Showing 50 random friends of 3