380 Posted Topics

Member Avatar for Labdabeta

I want to be able to make a program that emulates what a human at a computer can do. IE: I want to be able to read the visual information of a window (a 2d array of colour would be perfect) and be able to send virtual key syms and …

Member Avatar for Labdabeta
0
123
Member Avatar for Labdabeta

Hi, I am wondering if there is a somewhat simple way to output extended ascii values in c. Basically I am thinking actually about unicode characters, stored in ints. Is there an easy way to do this, or would it require a custom gui console?

Member Avatar for Labdabeta
0
240
Member Avatar for np complete

There are a lot of those primes out there, but generating them will undoubtedly be slow... especially if you want the really big ones. I would suggest A) looking into an arbitrary arithmetic library (so that you can handle epicly large numbers) then B) google for lists of large numbers, …

Member Avatar for TrustyTony
0
243
Member Avatar for lxXTaCoXxl

I find that nobody really uses preprocessor properly (aside from include statements of course). In fact they can almost always be removed completely since most IDEs have solid search/replace functionality (which is basically all that the define statement is). It is a lot faster to notice that you are typing …

Member Avatar for sepp2k
-4
271
Member Avatar for Labdabeta

I have two bounding boxes defined by the following values: m1.min.x;//the min x value of model 1 m1.min.y;// " " y " " " " m1.min.z;// " " z " " " " m1.max.x;// " max x " " " " m1.max.y;// " " y " " " " m1.max.z;// …

Member Avatar for Labdabeta
0
666
Member Avatar for RonKevin

You are probably right, you might need to use both... luckily c++ provides fstream.h which is a combination of ifstream and ofstream. If you are just outputting to the screen though you can just use the ofstream object cout provided in iostream.

Member Avatar for RonKevin
0
569
Member Avatar for snesnerd

I think that if you break this problem down it will be much easier. You want the median of one row, so you can isolate it, and possibly pass it to a median function. Then all you need to write is this: float calculateMedian(float data[], int datalen); This function will …

Member Avatar for mike_2000_17
0
2K
Member Avatar for 111100/11000

How do you intend to compare a string to a single character? An overloaded operator does not seem valid there. Perhaps create some kind of areEqual function instead. My guess is that you have made a logic error in that you are trying to compare two variables of different types …

Member Avatar for Labdabeta
0
328
Member Avatar for Labdabeta

Whenever I tell anybody under the age of 20 that I am a programmer, they always ask the same question sooner or later: "Can you hack my computer." I tell them that even if I could I wouldn't. They follow up by telling me to just make a pop-up or …

Member Avatar for VernonDozier
0
253
Member Avatar for gizmo7008

There are a number of issues with your code. The first one is merely for clarity and speed. Basically the isValidCharacter function can be 1 line: state return ((c>='A' && c<= 'Z') || (c>='a' && c<='z') || (c>='0' && c<='9') || (c=='.') || (c=='-') || (c=='+')); Thus removing the if …

Member Avatar for gizmo7008
0
186
Member Avatar for Sendy Hipo

I will help you out with what I can see from a quick glance. #1: Your vector stores generic 'Type' variables, so unless all of your vectors are vector<int> then you need your push_back function to take a Type value. Also you make a critical error that I used to …

Member Avatar for Sendy Hipo
0
961
Member Avatar for ldpasaje
Member Avatar for Labdabeta
0
2K
Member Avatar for Labdabeta

I have been having this problem since I started using stl containers awhile ago. Basically, when I debug them with the default Code::Blocks MinGW debugger I find that it gives far too much irrelevant information such as iterators and other 'behind-the-scenes' stuff. I can make it better by telling it …

Member Avatar for Labdabeta
0
306
Member Avatar for Labdabeta

I wrote this program because I often am asked by people that know that I like to make games to make just a quick simple game for some reason or another. I always make a simple text based adventure game (like Zork, but simpler) and they are usually happy with …

0
485
Member Avatar for WolfShield

Here is one straight from wikipedia: There are 10 types of people, those who understand binary and those who don't.

Member Avatar for itzarun
0
1K
Member Avatar for Labdabeta

Hello, It has been awhile since I have posted here since I have been horribly without computer for awhile now. Anyways, I was wondering if anybody knew where to find, or could make up, a lorem ipsum in C++. What I mean is that Lorem Ipsum makes a good filler …

Member Avatar for Labdabeta
0
2K
Member Avatar for Labdabeta

I have recently been accepted to software engineering at the university of waterloo, and as such my parents have agreed to go 50/50 on a nice computer to bring to waterloo. At first I was looking at a laptop, but then some IT friends of mine suggested that I could …

Member Avatar for Labdabeta
0
449
Member Avatar for claywin

Here is the issue, at least what I understand of it based on a preliminary review of your code. Basically, in the `handle_input` function, you declare a new event, but you do not set it to anything. It is going to be filled with whatever is left on the stack, …

Member Avatar for Labdabeta
0
170
Member Avatar for poloblue
Member Avatar for Schol-R-LEA
0
402
Member Avatar for Labdabeta

I have created a custom font for programming and I wish to use it in code::blocks. The thing is that code::blocks only allows for standard fonts (as far as I can tell) and so I cannot get it to recognise my font (even though it is a ttf). [Here](http://www.4shared.com/file/4avU0Xuh/lucidaprogrammer.html) is …

Member Avatar for Labdabeta
0
320
Member Avatar for Labdabeta

I want to use opengl to draw some stuff, not to the screen but to a data buffer instead. Is this possible? IE: uint32_t *data; glSetDrawTarget(data,GL_RGBA|GL_UNSIGNED_INT_8_8_8_8);//this is the line I cannot figuro out how to do glBegin(GL_TRIANGLES); //... glEnd(); //and now my buffer is full of custom data glSetDrawTarget(NULL,NULL);//reset to …

0
130
Member Avatar for TedOlga

I am not entirely sure about what you are attempting to accomplish, but there shouldn't be much of a problem. For one thing, you can make vectors of vectors to store many vectors like so: vector<vector<type> >//note the space it is essential! Also be careful to close all of your …

Member Avatar for Labdabeta
0
151
Member Avatar for NunsBeachSurfer

First of all realize how many elements you are storing, which is 115x4x114x114=5 978 160. Each element is a double, which is usually 64 bits (if I remember correctly) so 5 978 160x64=382 602 240 which is 382 megabits. Though this is well within the bounds of modern RAM, do …

Member Avatar for NunsBeachSurfer
0
152
Member Avatar for NetJunkie

I was introduced to programming four years ago in grade nine BTT10 Tech class. For about 95% of the year we just worked with the microsoft office suite, but for about a week or two we made small games using gamemaker. I was already a gamer and went overboard with …

Member Avatar for Reverend Jim
0
967
Member Avatar for Hellblazer.

I used learncpp.com they have excellent tutorials to teach you everything you need to know about c++ syntax. I am also working on a tutorial website myself (I have created almost 70 lessons so far) but that is more of a personal project. Also if you are so unimpressed with …

Member Avatar for sternone
0
203
Member Avatar for Labdabeta

I am wondering about what keyboard layouts the people that use this forum are using. I would suspect a higher quantity of Dvorak users (like myself) then most places. In my opinion there is no reason not to switch from QWERTY to Dvorak other than to switch from QWERTY to …

Member Avatar for hekri
0
147
Member Avatar for jakezcop

We need to know what types wallet, account, and savings are. Also you never check if the file is open, so perhaps it isn't opening properly? Also it would be better to make just one file and re-use it then to make 3 files like this: ofstream file; file.open("file1"); file<<data; …

Member Avatar for jakezcop
0
2K
Member Avatar for triumphost

I have made a few compilers for esoteric programming languages (I have no idea why but I find them fun to write :P) and I find that even making a simple compiler can be very tricky, c++ would be near impossible to write. Luckily, you can use g++ from a …

Member Avatar for mike_2000_17
0
1K
Member Avatar for Labdabeta

I used to use a tutorial for windows console API, but the website was taken down :(. So now I need to ask how to do these things (which ALL were included on the website) in the console with windows API: * Mouse events (clicks and unclicks) * Cursor seeking …

Member Avatar for Labdabeta
0
200
Member Avatar for Labdabeta

I have a C++ console project in Code::Blocks and I have set breakpoints to test an error. I have set the build for the project to produce debugging symbols for the debug build. I built it, then when I hit debug it just ignored my breakpoints and skipped to the …

Member Avatar for Goemon
0
9K
Member Avatar for binningen

Its complicated, but basically you need to add a level of pointer-ness. You can only return a value by address if you assign something to a memory location (IE: `*var=value;`) To do that here you can do this: void enlargeArray(int **oldArr, int arraySize) { //oldArr is a dynamically allocated array …

Member Avatar for mike_2000_17
0
167
Member Avatar for mayapower
Member Avatar for mike_2000_17
0
255
Member Avatar for FraidaL

My guess is that it is reading a/b as one thing. Have you tried entering a / b instead? Also note that you do integer division, so if a is less than b you will get zero as your value.

Member Avatar for FraidaL
0
137
Member Avatar for claywin

I definately think that you should try debugging this. Windows gives the error your seeing usually when it has a sigseg fault. This means that at some point you get a NULL pointer and try using it as if it were not NULL (either dereferencing it manually, or passing it …

Member Avatar for Labdabeta
0
1K
Member Avatar for haris riaz

Perhaps a path finding AI algorithm such as a depth first search (look it up) would be helpful. Basically if you can define this class you can solve any problem: class Node { private: //anything you need public: vector<Node> getAllPossibleMoves();//in this case it would return all valid selections of 0s …

Member Avatar for histrungalot
0
163
Member Avatar for Labdabeta

I have now read a total of 5 different winsock tutorials and I still do not get how sockets work! Could somebody please explain how to make a program that will allow n computers to share data with each other. As an example could somebody make a 'game' with the …

Member Avatar for Labdabeta
0
224
Member Avatar for tedtdu

If you are trying to break a byte into bits you can do this: struct byte{ bool bit[8]; }; byte breakByte(uint8_t val)//break val into individual bits { byte ret; for (int i=0; i<8; ++i) ret.bit[i]=((val>>i)&1); return ret; } byte fastBreakByte(uint8_t val)//this uses loop unwinding { //by negating the loop, this …

Member Avatar for Labdabeta
0
258
Member Avatar for ObjectOriented

Obviously you do not understand. Let me see if I can explain. Take for example this class: class myClass//it stores an int { public: int myInt; myClass():myInt(0){}//default value is 0 myClass(int i):myInt(i){}//you can set it on creation myClass(const myClass &o){myInt=o.myInt;}//copy constructor }; This works fine, and it is the struct …

Member Avatar for Divyab
-1
309
Member Avatar for Labdabeta

I am trying to understand how sockets work with winsock, but I just don't get it. I basically want to be able to create these functions: SomeDataType ConnectToComputer(const char *ConnectionName);//connect to the connection named ConnectionName SomeDataType CreateConnection(const char *ConnectionName);//create a connection called ConnectionName bool ReadData(SomeDataType, unsigned char *outdata, int outsize);//read …

Member Avatar for Labdabeta
0
201
Member Avatar for pjh-10

You could use an fstream object. Here is a nice wrapper class to act exactly like cout except it goes to screen and file: class fcoutstream { private: fstream file; public: fcoutstream(const char *fname){file.open(fname);} ~fcoutstream(){file.close();} template <typename T> fcoutstream &operator<<(const T& t) { cout<<t; file<<t; return *this; } template <typename …

Member Avatar for BobS0327
0
491
Member Avatar for coroche

Modularation would help make your code more legible. Use a function for each task you want to accomplish. In this case I would do something like this: #include <iostream> #include <string>//because they are easier than using c-style arrays of characters #include <fstream>//for file IO #include <vector>//Again they are easier than …

Member Avatar for coroche
0
140
Member Avatar for Labdabeta

I have the following code to draw a scene to opengl, but nothing shows up, just a blank screen! void glCameraDraw(const LABglCameraHANDLE h, LABglWindowHANDLE LABglGlobals) { if (!h->isProjected)//check to see if h's projection is loaded { glMatrixMode(GL_PROJECTION); glLoadIdentity(); //LABglGlobals->LABglDimensions are the screen dimensions gluPerspective(h->fov,(float)LABglGlobals->LABglDimensions.right/ (float)LABglGlobals->LABglDimensions.bottom, h->front,h->back); h->isProjected=true; } //set the …

0
85
Member Avatar for Labdabeta

I need to calculate chi squared cdf from x->infinity with n=255 degrees of freedom. I cannot seem to get it to work. You can find formulae for chi squared distributions using google. Here is my non-functional approximation code: double riemannsum(double(*fnc)(double),double dx, double xmin, double xmax) { double ret=0; double x=xmin; …

Member Avatar for Labdabeta
0
618
Member Avatar for minghags

The main difference between a depth first search and a breadth first search is what data type you use to store your nodes. In a breadth first search you use a queue, in a depth first search you use a stack. Basically a queue is like a line-up, you put …

Member Avatar for Labdabeta
0
449
Member Avatar for Labdabeta

I have an array of data of the form: union colour { unsigned int argb; struct{ unsigned char a; unsigned char r; unsigned char g; unsigned char b; }bigendian; struct{ unsigned char b; unsigned char g; unsigned char r; unsigned char a; }littleendian; }; struct sprite { int w,h;//stores the …

Member Avatar for Labdabeta
0
697
Member Avatar for 9tontruck

Show us main.cpp, it may help. Also use code indentation correctly (note: before leaving the 4 spaces you have to leave a new line)

Member Avatar for FelineHazard
0
146
Member Avatar for Labdabeta

I am using code::blocks and have written a dll. I am currently testing it but am getting tired of having to compile it, copy the DLL, DEF, H and A files into a test project, and then compiling the test project every time I need to fix something. Is there …

Member Avatar for Labdabeta
0
253
Member Avatar for Labdabeta

I am having a linker error in a file of some 3000 lines that I cannot seem to reproduce. I was wondering if anybody had any ideas where the problem could be. Basically I have a function in a header file and whenever I go to link my project it …

Member Avatar for Labdabeta
0
108
Member Avatar for nuclear

[This](http://www.songho.ca/opengl/gl_transform.html) link (and the downloadable example) helped me understand rotation in OpenGL far better.

Member Avatar for nuclear
0
4K
Member Avatar for pce369

I think this is what you are looking for: template <typename T>//allow for any type of node class LinkedListNode { private: T value; //store the value LinkedListNode<T> *next; //store a pointer to the next node LinkedListNode<T> *prev; //store a pointer to the previous node public: //getters: T getVal(){return value;} LinkedListNode<T> …

Member Avatar for Labdabeta
0
430

The End.