frogboy77 73 Posting Pro in Training

@ardav
I think you are great and i tell everyone all the time (at DW and everywhere else).

frogboy77 73 Posting Pro in Training

Note, I don't take ratings seriously (especially on DW)

I think you do. Go on admit it, you'll feel better about yourself.:)

frogboy77 73 Posting Pro in Training

not as embarrassing as i thought but no less painful:(

frogboy77 73 Posting Pro in Training

I predict:

Wales 21 - Ireland 20

frogboy77 73 Posting Pro in Training

you have 2 functions that are named the same and take the same argument.

frogboy77 73 Posting Pro in Training

Scotland should be treated with the disdain it deserves. Send out the under 16s and the over 40s and i fear we would still lose.

happygeek commented: biggest ROFL of the day so far +0
frogboy77 73 Posting Pro in Training

The question for us isn't wether we will lose or not. The question is how embarrassing it will be.

frogboy77 73 Posting Pro in Training

can you use vectors?
that would be my first port of call.
then either use sort or write (what i think is called) a bubblesort.

frogboy77 73 Posting Pro in Training

Will it be Scotland to thwart them again?

:D

frogboy77 73 Posting Pro in Training

I would love to see the Italians beat anyone but us.(although the missus probably wouldn't agree, being a good old gal from the valleys.)

frogboy77 73 Posting Pro in Training

I think Italy and Scotland need to be switched.
I would love to be more upbeat but hey im a realist.

frogboy77 73 Posting Pro in Training

you need to mark it solved

frogboy77 73 Posting Pro in Training

Does your compiler not have a problem with line 16(i.e declaring a variable twice)?

frogboy77 73 Posting Pro in Training

If room 5 doesn't exist the home may smell rather "funky".

Lighting would be the least of your problems.

frogboy77 73 Posting Pro in Training

a+=b;

is equivalent to

a=a+b;

frogboy77 73 Posting Pro in Training

Then you should mark the thread as solved.

frogboy77 73 Posting Pro in Training

what do you mean "it is buyer uplift only." ?

come and get it.

frogboy77 73 Posting Pro in Training

no problem you can have my old one but it is buyer uplift only.

EAnder commented: even a crappy computer from the 90s is decent enough to code on +0
frogboy77 73 Posting Pro in Training

You may recieve more help if you clearly state your problem. i.e what do you expect your program to do and what is it doing wrong.
P.S USE CODE TAGS.

frogboy77 73 Posting Pro in Training

i think you need to seed rand.

something like

srand(time(NULL));
frogboy77 73 Posting Pro in Training

In isprime can you not stop the search once the value in the vector is larger than the check value you send it?

frogboy77 73 Posting Pro in Training

a possible speed up would be to generate the primes in a seperate program and output them to a file, then read them into your program into a vector and check that. it would mean only generating them once.

frogboy77 73 Posting Pro in Training

This may work.

for(i=0;i<DetectedFaces.size();i++)
{
 temp.push_back(DetectFaces[i]);
}
frogboy77 73 Posting Pro in Training

With 2 nested loops(pure brute force) and a simple prime checker mine's works in about 1s but i'm too new to this to suggest where the slow down is.
Read the forum it's usually full of good tips.
As you have the generation of primes done you should take a look at the most recent problem(315). No maths but a nice programming exercise.

frogboy77 73 Posting Pro in Training

what about something like

for (int a = -999; a < 1000; a++)	
{				
      for (int b = 0; b < put size of array here; b++)		
      {				x = 0; 			
                                    while (isPrime(x*x+a*x+primes[b]))
                                    x++; 			
                                    if (x > max)			
                                    {				
                                    max = x;				
                                    max_co = a;				
                                    max_co_sec = primes[b];			
                                    }		
       }	
} 	
cout << max_co * max_co_sec << endl;
frogboy77 73 Posting Pro in Training

Am just a newb so this may be a stupid question, but i don't understand line 58

for (int b = -999; b < 1000; b = primes[index++])

why not

for (int b = -999; b < 1000; b++)

I've already done this but having looked at my code i'm not sure how(one off program so didn't comment on what i was doing) but both answers above are wrong although the second one is closer.

p.s what are your values for a and b?

frogboy77 73 Posting Pro in Training

as has been previously stated

int array[10]

contains 10 elements indexed from 0 to 9
if you attempt to read array[10] who knows what you will get.

SgtMe commented: as has previously been stated, therefore we do not need it again. +0
frogboy77 73 Posting Pro in Training

Would a loop where you take mod 10 then divide by ten work?
i.e

while(num>0)
{//some code to add to the stack num%10
num/=10;}
thelamb commented: yupp +3
frogboy77 73 Posting Pro in Training

can't say for the recursive version but for the iterative one you could put an if statement in the loop to see if the MAX value(for data type) divided by the next term to be multiplied is less than your running total then this would overflow the range of your data type, so break the program there and output the last value.:)

i.e

if(MAX/N<total){break;}

cout<<N;
frogboy77 73 Posting Pro in Training

don't really get your code as i'm a total noob but

if ( ( npx - opx !== 2 && -2 || npy - opy !== 1 && -1 ) && (npx-opx !== 1 && -1 || npy-opy !== 2 && -2) )

should these !== not be just != ?
may be completely wrong though.

Ancient Dragon commented: you are right :) +34
ccube921 commented: awesomeness +3
frogboy77 73 Posting Pro in Training

NO.
(as noob don't know if i could do this, but even if i could answer would be NO.)

frogboy77 73 Posting Pro in Training

Is this a joke?
Can you do it for me i can't be bothered?