frogboy77 73 Posting Pro in Training

I recently started using Code::Blocks and have written a small program to read in from a file. I think the problem i am having is the file not being found. Where does the IDE search for the file and how would i change this? Can i just input the whole address of the file?
Can post the test code if needed.

frogboy77 73 Posting Pro in Training

try researching this site

Edit
See WaltP

frogboy77 73 Posting Pro in Training

Played half a game(well). Still gutted. (the Mrs aint)

frogboy77 73 Posting Pro in Training

That was my problem, thanks!

Not the only one.

frogboy77 73 Posting Pro in Training

Tell you what -- do a search for this very topic and read the scores of previous suggestions that have been proposed.

Would i be allowed to make a comment in those threads or would that be "reviving the dead"?

frogboy77 73 Posting Pro in Training
frogboy77 73 Posting Pro in Training

1. Better indentation.
2. Start again.
3. Can you define a prime number?
4. (optional) Use a function.

frogboy77 73 Posting Pro in Training

Don't look.
See here.

frogboy77 73 Posting Pro in Training

Someone posting a better solution than the one previously posted, followed by an even better solution, etc.. Regardless of their reason for doing so has to be good for the thread and anyone viewing it in future. There is almost always a "better" solution.

frogboy77 73 Posting Pro in Training

Missed that:(

frogboy77 73 Posting Pro in Training

When i'm talking of James Bond i mean Sean Connery. If i was referring to any of the others i would clarify it.

Little bit of an Edinburgh link too.:)

frogboy77 73 Posting Pro in Training

In your program say i enter the number x=7

in your loop it goes

x(7)%i(2)!=0 so prime == 1
x(7)%i(3)!=0 so prime == 1
x(7)%i(4)!=0 so prime == 1 //needless since it cannot divide by 2
x(7)%i(5)!=0 so prime == 1
x(7)%i(6)!=0 so prime == 1 //same again
x(7)%i(7)==0 so prime == 0

If a number x, is not divisible by 2 then it can't be divisible by anything above x/2
If a number x, is not divisible by 2 or 3 then it can't be divisible by anything above x/3
etc...

frogboy77 73 Posting Pro in Training

Across the puddle it's 2-cents.

Well if you really want to be French then i wont stop you, but it is not a trivial decision.

Edinburgh is not ENGLAND.

frogboy77 73 Posting Pro in Training

WRT having to give a reason, I think I'd just put '...' if I couldn't be bothered.

Then why be bothered to give an opinion at all?

frogboy77 73 Posting Pro in Training

Okay, my basic point is, i think any critique should be justified(or at least an attempt made to do so).

frogboy77 73 Posting Pro in Training

I disagree with the idea of upgrading or degrading a poster anonymously without a reason.
If you want to "score" someone on their post, surely you should have to give a reason why you did so.
Do you think anonymous grading is the way to go?

VernonDozier commented: Anonymous isn't the way to go. I'm unanonymously evening out this post with pos. rep. +0
frogboy77 73 Posting Pro in Training

Good kick under a little bit of pressure, but a foul that makes the terrible sending off in the world cup look like a gentle hug.
The Mrs is happy so therfore i am happy.:)

The Super Bowl is an eighties soap (Dallas) but slightly faster and less interesting.

frogboy77 73 Posting Pro in Training

Mostly I find old threads cluttering up the forum with nothing of value being added to them. My 2p.

So are you suggesting deleting old threads? And it's tuppence by the way:)

frogboy77 73 Posting Pro in Training

I think your question needs to be less vague.
And as always use CODE TAGS it tends to get you more help if people can read your code.

frogboy77 73 Posting Pro in Training

I am becoming annoyed at the amount of responses on this site saying (something along the lines of) "This thread is 5 years old, please leave it alone.".

Then there is often the response (again, something along the lines of) "Please search the site before asking a question that has already been answered.".

Surely updating an old post regardless of the period of time since the original post, will help anyone searching the site to find the required information without starting a new thread (making the search quicker for the next person i.e less hits).

Does anyone else agree or am I out on my own here?

happygeek commented: agreed +0
frogboy77 73 Posting Pro in Training

I have sent a memo to the PM asking for the Scottish team to be let loose in the wild then hunted by men on horses with a lot of dogs. He has yet to reply.:(

frogboy77 73 Posting Pro in Training

Try here.

frogboy77 73 Posting Pro in Training

So if isprime equals true then the output is "Not prime"?

frogboy77 73 Posting Pro in Training

Sorry if i'm in the wrong forum but here goes:

Does anyone know how to restore a Toshiba Satellite laptop back to the factory settings?
The laptop did not come with any back-up discs.

frogboy77 73 Posting Pro in Training

So what have you got so far?

frogboy77 73 Posting Pro in Training

ok x=46.63
x = 100 * x // same as x*=100 ie x now equals 4663
google casting in c++
then work on ints using modulus

edit: the number i used was just random

frogboy77 73 Posting Pro in Training

No. double x=23.56
x*=100
iny y=(int)x
then use %

frogboy77 73 Posting Pro in Training

I did! The question was, does anyone know how long the delay is expected to last.

frogboy77 73 Posting Pro in Training

@AD??

frogboy77 73 Posting Pro in Training

so convert everything to cents
multiply up by 100 convert to int, use %, then convert results back to double

WaltP commented: Exactly! +17
frogboy77 73 Posting Pro in Training

May i also ask where these questions frequently occurred?

frogboy77 73 Posting Pro in Training

I believe it was due to start on Jan 23 and there has been a delay. I was wondering if anyone knew of the timescale of the delay.

frogboy77 73 Posting Pro in Training

Anyone got any information on when the OP's original link is going to begin?

frogboy77 73 Posting Pro in Training

works fine for me on an old compiler using windows

frogboy77 73 Posting Pro in Training

the second term of the array and add it with the third term of this array

you are taking the third item twice i.e 3+3

frogboy77 73 Posting Pro in Training

you could try a sieve

frogboy77 73 Posting Pro in Training

you need to seed rand as well

frogboy77 73 Posting Pro in Training

sorry meant

cout<<array[0][varpos];
frogboy77 73 Posting Pro in Training

if you create a variable say posvar
line 16

{min = array[1][j];posvar=j;}

then

cout<<array[0][j];
frogboy77 73 Posting Pro in Training

Could you not scan the numbers in a loop find the minimum and store the position in a variable then output the string in that position?

frogboy77 73 Posting Pro in Training

No ego involved.

a Moderator that's been here for over 7 years.

I beg to differ.

frogboy77 73 Posting Pro in Training
vector<vector<int>> vec(a, vector<int>(b));

Is this compilable? (i.e without the white space)

frogboy77 73 Posting Pro in Training

How is line 15 working?

if you change line 12 to

for(int i = 2; i < 12; i++)

it seems to work

frogboy77 73 Posting Pro in Training

I think you want to look at this.

frogboy77 73 Posting Pro in Training

ok so number =3145
you need a nested loop so you can check pos1vpos2 pos1vpos3 pos1vpos4 pos2vpos3 etc...(or work back from pos4vpos3 doesn't matter)
(google bubble sort if you need to)
then you need to isolate the 2 numbers into variables, say a and b
i started my outer loop with i=length-1 and decremented i.
so a=num/pow(10.0,i)
a=(int)a%10
the 2 lines are because pow requires pow(double,int). got some compiler warnings with this.(I told you it was ugly)
inner loop starts at j=i-1
so b= same as above but with j not i.
now you have the 2 numbers to compare
if they need to be swapped then take them away from number ie number-=3000,number-=100 then add back in number+=1000, number+=300 (leave that code to you)

easterbunny commented: well written and usefull +1
frogboy77 73 Posting Pro in Training

OK just done it i think.
Use a while loop for the length of the number.
Then sort the number checking each digit against the next (bubble sort) after separating them into 2 variables using / % and pow. If they need swapped remove the variables multiplied by the corresponding pow - then add by multiplying the variables by the correct pow and they should have swapped places. Using a nested loop to go right through the number.
Sorry i don't think i've explained it very well.

EDIT
Just ran it again and zeros are an issue. Doesn't work with them.
That can be fixed by checking the length at the end against the length at the start and outputting the appropriate number of zeros before the number.(UGLY i know)
Except leading zeros but who uses those.

frogboy77 73 Posting Pro in Training

line 75

frogboy77 73 Posting Pro in Training

make a string array of your responses then randomly pick one element. ie string ans[5]="blah" etc... ans[rand()%5].

frogboy77 73 Posting Pro in Training

I have a 15 year old protect me at all times. He does all my dirty work because he's still a minor. Saves me the time in the big house (could only get a ps2 and 720i tv - can you believe the inhumanity).

frogboy77 73 Posting Pro in Training

I don't understand what you mean by

generate the number of tries when the user wins

Should line 76 not be averageWin=(winGames/totalGames)*100;
The percentages will not work if you are using ints. i.e 36 games won, 72 games played
36/72=0........... 0*100=0
Use doubles.