380 Posted Topics

Member Avatar for akfjmalcmask

The solution will depend on your specifications, you are being very vague about how you want to encrypt it. If all you want to do is make it hard for somebody to use unless they have a decryption key you can just open the .exe file as you would any …

Member Avatar for akfjmalcmask
0
2K
Member Avatar for Harsh rocks

Step 1: Install Compiler/IDE (I like to use Code::Blocks/G++) Step 2: Write program (You can learn C++ from many sites, I taught myself using learncpp.com) Step 3: Compile program (I set up Code::Blocks to use g++, but using the built-in MinGW works too) My guess is that you have either …

Member Avatar for Labdabeta
0
129
Member Avatar for hitesh suthar

Basically, when a function is called in assembly language (which is what your C++ code gets turned into by the compiler) it actually takes real time to set up the function and return from it. In pseudocode this is what a function actually is (C++ hides this from you): 1. …

Member Avatar for rubberman
0
132
Member Avatar for lara_

While this thread is somewhat alive again, I have always wondered if it would be possible to use __asm to use assembly language to emulate getch(). INT 21 with AH = 07 seems to pop out at me. I just have major trouble with my assembler and I do not …

Member Avatar for nootan.ghimire_1
0
7K
Member Avatar for christinetom

The issue is that char is an integer type, so `a+b` will add the ASCII values of a and b, which gives weird output. Converting them to strings works fine, except that strcat uses `char*` c-style strings and you used `std::string` c++ style strings. Here you have 2 options: Option …

Member Avatar for christinetom
0
466
Member Avatar for Labdabeta

Hello, I have a quick question about c/c++ syntax. Basically I am wondering when it is allowable to have numbers in identifiers. My compiler happens to allow numbers in: * Function names * Class names * Variable names * Pre-processor names As long as they do not begin with numbers. …

Member Avatar for Labdabeta
0
227
Member Avatar for Labdabeta

I need to know which of these three copies of code is considered best. I also need to which one is more efficient memory wise and which is more efficient time wise. Thanks: enums [CODE]enum MyEnum{EnumTypeOne=1,EnumTypeTwo=2,EnumTypeThree=4,EnumTypeFour=8};[/CODE] macros [CODE]#define EnumTypeOne 1 #define EnumTypeTwo 2 #define EnumTypeThree 4 #define EnumTypeFour 8 typedef …

Member Avatar for Ancient Dragon
0
1K
Member Avatar for Labdabeta

Hello, I have used taylor polynomials to approximate floating-point values before. I am wondering whether there is a way to still apply them to functions with complex arguments, and if there is a way what its constraints would be. For example, to calculate the sine of a floating-point number to …

Member Avatar for ddanbe
0
256
Member Avatar for mrnutty

I guess I'll chime in. I always end my emails with "Veni, Vidi, Didici"-(LAMBDA)(ALPHA)(BETA) since my initials are LAB but using λαβ just looks so much cooler. I came up with my slogan last year in latin class while reading De Bella Gallica (On the gallic wars) by Julius Caesar. …

Member Avatar for Reverend Jim
0
687
Member Avatar for imalysha425

The issue is that inFile isn't global, so every single function gets its own brand new version of inFile. The result is that you open it, then close it, then start trying to extract data from nothing. Either make inFile global, or pass it to each function that uses it …

Member Avatar for richieking
0
260
Member Avatar for user4678

There are a few problems with your code, but the only critical errors are in the calculate function so I will start there. First of all when you declare temp and x you dont give them values, so they can be any value they want. This means that when you …

Member Avatar for Labdabeta
0
634
Member Avatar for Labdabeta

Hello, I can get OpenGL to render 3D scenes to the screen, but I want to render them to a pixel array. Basically I want some magical code to fill in the blanks for this code segment: int width=500; int height=500; uint32_t *colours=new uint32_t[width*height]; //Magic code! glBegin(GL_TRIANGLES); //other drawing stuff, …

Member Avatar for Labdabeta
0
5K
Member Avatar for surfingturtle

This is a classic problem in computer science. Basically it is a neat case of induction. For towers named A,B,C: Start with a tower of just 1 disk. Transferring it is as easy as moving it from A->C. If you have more than 1 disk its a bit more complicated. …

Member Avatar for surfingturtle
0
915
Member Avatar for Labdabeta

Hello, Unfortunately I learnt OpenGL from NeHe tutorials, which means that all of my current methods for OpenGL-ing are extremely deprecated. I tried to find a more up-to-date tutorial, but all they seem to do is teach how to get really complicated stuff out of OpenGL. I just want to …

0
197
Member Avatar for Labdabeta

Hello, I am working on an event driven library and am having one minor problem. Basically I have two ways to get what I want done. Method 1: Smart pointers and factory functions #include <iostream> #include <vector> #include <memory> using namespace std; class Object { public: virtual int getInt(){return 0;} …

Member Avatar for Labdabeta
0
257
Member Avatar for apiatex

Ok, I did it! Now its your turn. This forum is not for people to do things for you. Its to help you. Make an attempt before asking for help. Instead of posting "Write this for me!" post "I wrote this: <code here> but it doesn't work, can you explain …

Member Avatar for phorce
0
189
Member Avatar for Labdabeta

Hello, I am having a particularly nasty case of "What is the syntax?" while working on an event driven library. Basically this is what I want: class Object {// private: public: virtual bool onEvent(Event e)=0;//all objects have to react to events Object operator|(const Object &o) { // I want to …

Member Avatar for Labdabeta
0
311
Member Avatar for cambalinho

Yes. C++ has inheritance as well as generic types. This gives it full objective polymorphism. Polymorphism is actually one of the things for which C++ is famous http://lmgtfy.com/?q=C%2B%2B+Polymorphism .

Member Avatar for mike_2000_17
0
235
Member Avatar for Labdabeta

Hello, I am wondering how libraries create graphics contexts in a cross-platform manner. Somehow libraries like SDL create graphical windows seemingly without using the system headers. I know how to set up a window for graphics using Win32API, and how to get input from it using the same. How do …

Member Avatar for Labdabeta
0
355
Member Avatar for Labdabeta

Hello, I noticed that in c++ everything that can be done using a static function in a class could be done by using a public function in the same namespace. Assuming that you bind your classes in a namespace these functions do not take up names in the global namespace. …

Member Avatar for mike_2000_17
0
204
Member Avatar for Rahul47

It is completely situational. Here is an example: 1000001 What is that number? If you interpret it as a 7-bit unsigned number you get 65. If you interpret it as a 7-bit sign/magnitude number you get -1. If you interpret it as 1's complement you get -63. If you interpret …

Member Avatar for Labdabeta
0
240
Member Avatar for Labdabeta

This is more of a tale of "I think I broke it". Basically as an assignment for CS I have to write an assembler for a subset of the MIPS assembly language. Currently it is not working, getting a sigseg, so I decided to debug the code and step through …

Member Avatar for rubberman
0
306
Member Avatar for rookieNeedsHelp

atoi does indeed only work with cstrings, however you can convert an std::string to a cstring using .c_str(). So for your example I would guess that the solution is: totalMins += atoi(MovieRecord->getMinutes().c_str());

Member Avatar for rookieNeedsHelp
0
263
Member Avatar for Kuroshi

I believe the true answer is irrelevant. Firstly it could differ based on implementation, and it is entirely possible that if it currently does have a limit, it would be removed in future. The big issue is that whether or not you have space for something is irrelevant. There are …

Member Avatar for JamesCherrill
0
162
Member Avatar for Labdabeta

Hello, I have recently decided to learn TeX for note taking purposes (both my parents are doctors, I inherited my handwriting from them, my class notes up until now look somewhat like the voynich manuscript) since MS Word takes far too long to type equations into. Overall it is going …

Member Avatar for mike_2000_17
0
394
Member Avatar for prajeet10

No, that is not what this website is for. You should try it for yourself and then ask for help with a specific problem.

Member Avatar for kal_crazy
0
719
Member Avatar for pritaeas

In both Firefox and Chrome, when I snap the window to the edge of the screen I no longer get the drop down menus from the bar at the top. IE: if I mouse over "Software Devolpment" I don't get the option to select a subforum. However, it works if …

Member Avatar for Dani
0
1K
Member Avatar for pritaeas

I have a couple issues with the current layout. 1) Small version When the browser is in maximized mode all of these issues are gone, however I always have my browser snapped to one side of the screen. When it is like this I lose access to "Last Updated by" …

Member Avatar for diafol
0
1K
Member Avatar for CCHIndiaStore

Honestly, no language right now is optimal. As has been clearly stated, it depends on the situation, and almost every language out there has situations where it would be best. You can google search for analogies easily (like this one http://compsci.ca/blog/if-a-programming-language-was-a-boat/ ). The issue is that no matter which language …

Member Avatar for mike_2000_17
-3
370
Member Avatar for nirbilcahn

I still do not believe that is what is desired here. What seems to be the goal is some function like `vector<string> getAllPalindromes(string str)` that returns all palindromes in a string. So for example, `getAllPalindromes("No lemon, no melon!")` should return `{"nolemonnomelon","olemonnomelo",...,"onno","nn"}`. As far as I can tell there is no …

Member Avatar for vijayan121
0
412
Member Avatar for nitin1

Perhaps see how many of these you may wish to include: http://en.wikipedia.org/wiki/List_of_mathematical_functions Other than that, if you finish early and want an extra challenge you can modify your program to be "arbitrary" precision. IE: with integers/rationals infinite precision and with irrational numbers some set, very high, precision. Finally, I agree …

Member Avatar for Labdabeta
-1
191
Member Avatar for imBaCodes

Both of my parents are doctors... here are some tips that work wonders: 1) STAY HYDRATED!!! 2) Try leaning your head to the left, then right. Make your head look like this \/\/\/... do it slowly-ish. This causes your jugular veins to get compressed. The brain, fearing that something is …

Member Avatar for Troy III
1
617
Member Avatar for rgugopi

Technically there is Furer's algorithm, however it has enough overhead that it is rarely used. Indeed it has slightly better asymptotic performance than the Schonage-Strassen and is, in a sense, a generalization thereof. You can read about it here: http://www.cse.psu.edu/~furer/Papers/mult.pdf (Credit for the link has to go to rubberman, its …

Member Avatar for Labdabeta
0
125
Member Avatar for iamthwee
Member Avatar for Dani
1
383
Member Avatar for james.lu.75491856

In my programs I usually only encounter 3 types of epic one liners, they all use the ternary conditional operator extensively. (all in c++) Type 1: Conditional arithmetic - When I want to change how an equation behaves based on conditions. Example taken directly from the add function of my …

Member Avatar for vegaseat
0
171
Member Avatar for cedwards

Your problem is that '0' is not the same as 0. '0' is actually 0x30 (IIRC). However your entire algorithm has a fatal flaw. You should realize that rand() is random (or at least relatively close to random) which mean that any sequence of numbers is fair game for it. …

Member Avatar for vijayan121
0
282
Member Avatar for prathiyus

You will need to provide more information. How are you storing the matrix in your program What do you want to do with it? and very importantly what have you tried so far? Unless you give us some code to work with we can't help you.

Member Avatar for Labdabeta
0
119
Member Avatar for sash_kp

I assume you are asking how to partition an array into two sub-arrays. This can be done like this: void partition(int *src, int srclen, int *a, int alen, int *b, int blen, bool(*part)(int)) { a=malloc(srclen*sizeof(int)); b=malloc(srclen*sizeof(int)); int aindex,bindex; aindex=bindex=0;//set the indices to 0 for (int i=0; i<srclen; ++i) { if …

Member Avatar for David W
0
444
Member Avatar for mcnickn
Re: c++

Sounds like a good project. You should probably get started on it. This forum doesn't do your project for you, rather we help you with specific problems. For this project I would suggest you look at http://en.wikipedia.org/wiki/Insertion_sort and http://en.wikipedia.org/wiki/Merge_sort . Good luck.

Member Avatar for Dewey1040
-3
168
Member Avatar for Alxprog

Take a look at the std::(o/i)fstream classes. They have everything you need. Once you have some specific code, we can help determine where you went wrong. Basically you will want to pull the numbers out of the time/dates (basically by ignoring the ./: characters) then translate them into the ints …

Member Avatar for Labdabeta
1
328
Member Avatar for Labdabeta

Hello, I have a chain of inherited classes like this: class A { protected: int a; public: int getA(){return a;} }; class B:public A { protected: int b; public: int getB(){return b;} }; Based on that you can see that the public can only read the values in those classes, …

Member Avatar for Labdabeta
0
257
Member Avatar for Labdabeta

Hello, I was just noticing that the 'const'ness of references often causes me to rewrite a large chunk of my code with pointers. For example if I have a class that needs access to a large amount of data from another class I would love to use a reference. However …

Member Avatar for mike_2000_17
0
410
Member Avatar for james.lu.75491856

I'm sure a bunch of you have seen this already, but don't forget the alt-text. http://xkcd.com/1185/ Anybody want to implement DaniSort with that shiny new API?

Member Avatar for james.lu.75491856
0
475
Member Avatar for Labdabeta

Hello, I am about to move to a new home (with better internet) and I was thinking of buying a liquid cooling system so I can overclock my CPU and GPU(AMD FX-6100 Hex-Core and NVIDIA GeForce GTX 560 Ti respectiveley). I just do not really understand how liquid cooling works. …

Member Avatar for Rik_
0
252
Member Avatar for Labdabeta

Hello, First of all some background. My friend and I are having a bit of a competition over theoretically infinite number storage. We have agreed that the first person with a working arbitrary precision integer library with the theoretical ability to store an infinitely large number (IE: if the hard …

Member Avatar for Labdabeta
0
303
Member Avatar for Asus93

Before getting to the issue at hand, I need to mention that you are making your code a little harder to read because you have `double x;` and `double value;` as both global and local variables. Please move those into the main function, they have no place in the global …

Member Avatar for Asus93
0
695
Member Avatar for Labdabeta

Hello, As may be apparent from my previous posts, I am in a "If its worth doing, its worth overdoing" sort of competition with a friend of mine. Our goal is arbitrary precision integer arithmetic. I think I am close to getting the data storage working, but now I want …

Member Avatar for Labdabeta
0
1K
Member Avatar for Frank_5

Firstly, this is more of a code snippet than a discussion thread, no? Secondly the methodology you used is flawed. Instead of getting input inside the class functions you should move it outside. Instead of enqueue() you should use enqueue(int val) so that you can add values to the queue …

Member Avatar for rubberman
0
2K
Member Avatar for Labdabeta

I have a program using old data for a game I play to indicate which pixels correspond to the health bar in my game. (my program just loops until a button is clicked and presses a key if the health bar drops too low). Unfortunately the health bar has moved …

Member Avatar for triumphost
0
800
Member Avatar for Labdabeta

Hello, I made an arbitrary precision integer library a few weeks ago. It works well, but is bounded by `256^(8*sizeof(size_t))` because it uses a simple dynamically allocated array to do its work. I want some way to have theoretically unbounded storage. I think that file io is probably best, but …

Member Avatar for Labdabeta
0
213

The End.