- Strength to Increase Rep
- +9
- Strength to Decrease Rep
- -2
- Upvotes Received
- 77
- Posts with Upvotes
- 62
- Upvoting Members
- 54
- Downvotes Received
- 3
- Posts with Downvotes
- 3
- Downvoting Members
- 3
I love to program, just a fact. I'm also very good at both programming and mathematics. I am from near Toronto in Canada. I ski.
- Interests
- Programming, Skiing, Kayaking, Mathematics, Chess, Computer Gaming
- PC Specs
- I have a very nice computer running Arch Linux on dual monitors. Ask me for more info if necessary!
380 Posted Topics
Re: "I'd hate to die twice. Its so boring." - Richard Feynman's dying words. | |
Re: I'm the same way with javascript, I find it very hard to get anything done. However most C++ constructs do exist in javacript, including multidimensional arrays, for loops, etc. You can easily google for "How to do <something> in javascript" and get loads of answers and examples. Post a first … | |
Re: It stops working because you have no code in those sections. If you choose 'B' you will execute this code: else if (choice== 'B' || choice=='b') { } Which of course does nothing. Similarly after you create your arrays you don't do anything with them, so again it stops working. … | |
Hello, I am having a bit of an issue with my networking addition to my game engine. The engine uses SDL to provide an event-driven programming environment. I tried adding networking functionality, but it doesn't seem to work. Here is the relevant code: //includes #if defined(_WIN32) #include <winsock2.h> typedef int … | |
Re: I got 22... but that was with a 0 in the relationship questions, but I have never really been in any serious relationships and I am pretty sure that I would eek a few more points out of those. Also I have been diagnosed with ADHD,OCD, and Aspberger's syndrome... so … | |
Hello, I am working on a moderately large web development system and have been charged with developing the server-side application for the web site. As a primarily local developer I have by far the most experience in C/C++. My favourite language is Ada, just to give you a sense of … | |
Re: I don't normally resurrect dead threads, but I will make an exception. These types of esoteric programming problems are often frowned upon for teaching bad programming practices. This is not their purpose. As the IOCCC explains, these types of problems promote thinking into what might occur that would be bad … | |
Hi. I am familiar with the following C graphics libraries: Cairo, SDL, SDL2, and OpenGL. The problem I have found with these is that they either require shared libraries (Cairo/SDL/SDL2) or are difficult to make cross-platform (OpenGL). I am wondering if there are any graphics libraries for C that do … | |
Re: `cin >> t1 >> t2 >> t3` I know that it seems like an unintuitive way to get 3 values from input, but it makes sense once you learn about istreams and the fact that cin is one. | |
Re: By hand. What they did was they wrote out the code of the compiler in some slightly-higher language. Then they manually went through the code and compiled it themselves. Once that was done they could use the compiler to compile any future sources. New compilers would then be 'bootstrapped' using … | |
Re: First of all the code `for (a=4; a<5; a=a++)` is undefined behaviour, you probably meant `for (a=4; a<5; a++)` which 'loops' a from 4 to 5 (essentially just running the loop once on the value a=4. To use a value found inside the loop outside of it, it must be … | |
Re: Judging by your code it looks like you are doing Android development and trying to pass data from one activity to another. Due to the nature of Android activities (multithreaded, and can be GC'ed at any moment if, e.g. you get a phone call) you can't deal with passing data … | |
Hello, I recently wrote a program that I wish to be portable (IE: no installer, just raw files). I have made an icon for the program and can attach it to a shortcut, but not to the executable itself (it stays as the default). On top of that I have … | |
Re: Functions are used to pack repeated code together. The general form of a function is this: <return-type> <identifier>(<arguments>) { <body> } This means for example that these two programs are effectively identical: A version with no functions #include <stdio.h> int main() { int mode,num; printf("Please choose to print (1) Increasing … | |
Re: In your current code you populate the array with `sc.nextInt()`, now you want to populate them with random numbers. There is a method called `Math.Random()` which gives you a random number from 0 to 1 (including 0, not including 1). You will have to 'stretch' the number you get to … | |
Re: First of all that is C++, not C. Second your problem description is poor, however I think I understand what you are after. Of interest is this code snippet: //This code returns the n'th cycle of string s std::string tmp; for (int i=0; i<s.length(); ++i) tmp+=s[(i+n)%s.length()]; The way it works … | |
Hello, I posted on this forum two times before about a particular pair of non-printing characters being inserted into my code. You can find the threads [here](https://www.daniweb.com/software-development/threads/441611/stray-non-printing-characters-in-my-programs) and [here](https://www.daniweb.com/software-development/cpp/threads/450296/arbitrarily-appearing-non-printing-character). Two great posters tried their best to solve this problem (mike_2000_17 and deceptikon) to no avail. Finally, using the hints that … | |
Re: Your problem is that you are printing the number of semicolons (which is the correct name for 'dotcoma', its like a colon (':') but only half ';') The line in question is printf("Row %d: %f\n", j+1, (float)dotcoma[j]); The issue here is three-fold. 1: j is uninitialized, some compilers will set … | |
Re: Granted, the great war for the moon breaks out. I wish I invented interstellar flight. | |
Re: I find that "Quinary son of a genetic algorithm" rolls of the tongue quite nicely when I want to let off some steam. As for a single word... Queueing's vowels sound awesome. (as noted by Randall http://xkcd.com/853/) | |
Hello, I used to use Code::blocks and eclipse for code editing, but started to find them slow. I started searching for lightweight IDE's and found that the prevailing opinion is that if you are looking for lightweight code creation you should use vim/emacs, gcc and the other gnu utilities. I … | |
Re: Heavy rain followed by negative temperatures = black ice... black ice everywhere :O. (Waterloo, ON... I think Toronto, ON too) | |
Hello, I have an issue with a plain TeX document I am writing. I need to compile drawings as well as images into pdfs. I know how to get images into a pdf using \pdfximage which works if I compile with pdfTeX. I also know how to get drawings into … | |
Hello, I have a USB key on which I do all of my programming. It is formatted as an NTFS drive with 32 gigabytes of space. On this drive I have large C::B projects which contain both windows and linux executables. When I try to run the linux executables it … | |
Re: In java, `x<<y` shifts x y bits to the left. `x>>y` [arithmetically](http://en.wikipedia.org/wiki/Arithmetic_shift) shifts x y bits to the right. `x>>>y` [logically](http://en.wikipedia.org/wiki/Logical_shift) shifts x y bits to the right. These operations are invaluable when you need to manipulate individual bits of a value. For example, lets say you are using a … | |
Hello, I have a bug in my program somewhere and I cannot understand why. The program merely prints data from a binary file. Here is the code: #include <iostream> #include <fstream> #include <vector> #include <cstdint> using namespace std; int main(int argc, char *argv[]) { if (argc!=2) { cout<<"Invalid argument count, … | |
Hello, I have learnt a few assembly languages (MIPS/x86/ARM/MIX) and I have a question about the call stack. Each of those languages uses a different method for subroutine linkage, and the way I learnt them was not conducive to recursion. Granted, if I continue reading my copy of The Art … | |
Hello, I recently took a course on assembler/compiler construction. In it we covered parsing algorithms such as LL(n), LR(n), LALR(n), and SLR(n). I understand how these parsing algorithms can be used to determine **if** an input string follows a context free grammar (CFG). At some point I also understood how … | |
Re: The issue is that `localtime` and `localtime_s` are slightly different. The _s stands for safe, it is a memory safe version of `localtime`. As such it does not create it's own `tm*` to return, rather you have to send it one. The correct code would be: time_t now = time(0); … | |
Re: This is one of those sneaky bugs. Basically it is telling you that if you declare a variable in the for loop, it only lasts as long as the for loop. At first glance it looks like you only ever use 'n' inside your loop. You are wrong. Let me … | |
Re: What have you got so far? What libraries are you using for I/O (Win32API/SDL/SFML/etc)? Typically you will use your I/O library to poll for events, then detect the arrow key events and use them to modify a variable that holds the ship's position. How this is done varies by library, … | |
Re: You need to ensure that all 3 files will be included in your project. You have to set it up so that first samclass.cpp is compiled, creating samclass.o. Then main is compiled. When main compiles and sees samclass.h with undefined functions it will look for the object file and use … | |
Hello, I was recently looking through some of my code and found what I believe to be a memory leak. It is in a function that appends two strings and I am not sure how to resolve it. Here is the function: const char *strapp(const char *str,const char *s) { … | |
Re: There are quite a few issues with your code... I will go through them one by one. 1) Invalid entry point void main { Is not the correct way to create your main function. The correct way is: int main() { //code here } or int main(int argc, char *argv[])//or … ![]() | |
Re: I only took a quick glance at your code. However I did notice one likely bug in your program, particularly in the CCalcCorr class. The issue is that everything in the class is private, which means it would be very difficult to actually call anything from it. You probably meant … | |
Hello, I feel like this is probably something silly, but for some reason if I declare a variable at a certain point in my code, then never use it... it crashes. This is literally what happens: //... code here int isBuf=0;//one of my variables int zeroAddr=0;//<-- another variable I want, … | |
Hello, Looking at the standard streams provided by the stl libraries, it seems as though it is impossible to have 1 stream to use for both standard console IO and file/string IO. However, before I give up I would like to ask, is this possible: generic_stream stream; stream=cin; //now I … | |
Hello, I have a `HWND` for a window. I have double checked that it is a 100% valid window by using `SetActiveWindow()`, `SetFocus()`, and `SetForegroundWindow()` on it, successfully bringing it to the frontmost window. However whenever I try to use `GetPixel` on it it returns -1 (0xFFFFFFFF). What am I … | |
Re: You have 1 syntax problem and a few redundancy problems. First lets tackle the syntax problem so that you can get your code to run. The syntax error is that `void distance(miles)` is not valid C++ code. When you have parameters in a function it **must** have a type. What … | |
Hello, I have a file which I need to read which contains some unusual characters (EG: 'â• ') and I need to be able to read it and convert those characters to numbers. As an example of what I am looking for would be code that reads a file and prints … | |
Re: I currently suck at web-based stuff, but I have been wanting a modified interface for awhile, I am talking with a friend of mine who is very into web-based stuff to help me out, but my main concern is that neither of us is experienced enough to get my idea … | |
Re: There are a few issues with your code, however the one causing the issue is a simple OBOE (off-by-one-error). The number one thing that jumps out at me is that you really should be using an array here, it will literally make the part of the code that deals with … | |
Hello, I wrote a library for arbitrary precision arithmetic recently and spent a long time implementing efficient multiplication algorithms. Now I am looking to see if it is possible for me to optimize anywhere else. One place that I thought should be more optimizeable is my division algorithm. Right now … | |
Re: I am not 100% sure what you are asking since I can't access the code. However I think I understand what you are asking. You have two classes that refer to each other and want to have each in their own headers. The key to remember is that the `#include … | |
Hello, I have a particular set up of cast operators and constructors which is leading to a compile-time ambiguity error. I am wondering if somebody can explain why this is happening and what can be done to fix it. For example, here we have 2 classes: class A { int … | |
Re: The issue is that you set `charges=number*PRICE_CONSTANT` each time, without saving the old value. Basically here is what happens if you trace charges (program tracing is a very valuable debugging tool): Charges: ??? (since its un-initiated it could be anything, changing line 24 to `double charges=0.0;` would fix this) Choice: … | |
Re: Check your types, noting that `char x[]` is identical to `char *x`. So you can think of `char *colors[3][10]` as being the same as `char ***colors` or `char colors[][3][10]` either way you can see that colors is one level of pointers too deep. Removing the `*` on line 5 should … | |
Re: Making games is difficult. I would put off making your current idea for a game until later and here is why. Ideas are cheap in the game industry. If you think about, say, the novel industry a good unique idea is valuable. The reason is that most good book ideas … | |
Re: I am not certain due to the ambiguity in your post, but I think you want to know how to do a deep copy. That is, how to copy pointer values of one class to another such that they don't point to the same object. For this I would point … | |
![]() | Re: I am not sure exactly what you mean by #2, but I can tell you about #1. The difference is that, as far as I know, you cannot create an array variable without setting it to point to a value. Specifically when you say `int a[5]={1,2,3,4,5};` it sets a to … |
The End.