I'm pretty sure that I answered this within the absolute first paragraph (and the program is actually C++ that uses this method because it's quicker):
No, my first port of call was looking...
Type: Posts; User: Swordsman
I'm pretty sure that I answered this within the absolute first paragraph (and the program is actually C++ that uses this method because it's quicker):
No, my first port of call was looking...
You suggest that I should learn C# by some other way apart from programming in C#? Should I give Go a bash to see if it helps instead?
Hi all,
My C# is VERY basic, but I've been given the task of converting a C++ program into C# anyway. This part of the program is pretty simple, and is trying to read a certain amount of bytes...
I've changed the initial array to include 0 and 1 to match the positions of the vector up.
Thanks for the help anon, here is the finished code:
vector<int> primes;
int n, numToCheck;
Thanks for your continued help.
My second for loop has changed to:
for(int j = numToCheck; j < primes.size(); j += numToCheck)
though I am still wondering how to mark the numbers in...
Thanks for the comments.
I was using two vectors as the plan was to remove them as I go, and not just mark them, which looking at the algorithm, is the wrong way to do it. I started with the...
Hi all,
I am currently trying to implement a Sieve of Eratostheneses in C++ as part of a book I am learning. The objective is to find all of the prime numbers between 1 and n in a list. To...
Has anyone mentioned Bjarne Stroustrup's P3 book yet?
After purchasing many, many books focusing on learning C++, I still rate this as the best. Hell, I happen to think that this is the best...
So, when exactly would one use the
Creature creature;
Creature creature = new Creature();
Creature* creature
initialisations?
Can anyone think of any use cases to split up how you would...
Hi all,
I'm just trying to learn Visual C++ and I'm having a problem with the OpenFileDialog control. I'm trying to drag out the filename selected in to a text box, but MSDN has given me broken...
Hi all,
I have a quick question about DX9. I have recently started with it after a while using OpenGl, kinda trying to expand my knowledge base a bit. Anyway, I downloaded the DXSDK (June 2008)...
Hi all,
I have a quick question on the usage of the extern keyword. I'm trying to get a variable to be of global scope, but as it is of a custom type, I'm not sure how to use extern and Google...
Thanks, can you explain what this does though please as I'm a bit confused :P
I'm familiar with modular arithmetic already but I'm not sure how to implement a mod 26 function inside the code.
As I'm using ASCII to shift the letters, could I just say something like:
...
Hello,
I'm currently learning C++ and have decided to write a Caesar implementation. I have the code working but lack error checking (dealing with spaces, going back to start of alphabet) and am...
Thanks for the help everybody. For those who were interested, I went with a combination of Salem's and Bubba's answers.
The easiest way of explaining to him was to first tell him why computers...
Hi all,
I've got a question which I didn't know how to answer, and where else to post it.
I program pretty much everyday and recently, my 5 year-old nephew has been sitting with me and asking...
I'd completely forgottten about the Atari ST! While I didn't use it to program, it was a great gaming rig. I still wonder how many hours were wasted on that playing Bubble Bobble and Elite instead...
If you're using DevC++ or a similar IDE, you might want to think about putting getch() in there so you can actually see the result without having to run it from command line.
printf("%d...
After reading the Windows 3.1 thread, I got thinking. How did all of you start out in your programming endeavours?
What was the first language you used and how did it happen?
As I mentioned, I...
Thanks to twomers for saving me. I thought I made a terrible mistake then :)
I've still got a copy of Windows 3.11 for Workgroups on an old Compaq Laptop!
I use it for when SEGMENTATION FAULT! and such things give me a headache and I want to play about in QBasic.
I still...
I would imagine that Deimus is using either Visual C++ or DevC++ to write C code as it automatically saves it to a cpp extension. If you are being asked to save a C file as the cpp format, I would...
I edited the current code in to the top post.
The input file is just literally a text file with the words "hello middle middle end" inside.
*Fixed*
I had already taken out the free the tree/close file after I had posted, as it was one of those things that I had played with and not taken out. The fscanf I completely missed :)
...