- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 3
- Posts with Upvotes
- 2
- Upvoting Members
- 3
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
Re: You can use the GetAKeySyncState() function from windows.h. | |
Re: lmgtfy strikes again! But seriously; we aren't your search engine jockies. Please try to refer to internet sources before coming to Daniweb; we can help you interpret, hell we can help you write, but we WON'T do what a child can do alone. | |
Re: run it in command line, is it outputting what it is supposed to? | |
So basically I'm making a generic class for rational numbers, and I want to do automatic type conversions in comparisons and operations and constructors. How would I go about doing this? Google has only returned results for template functions rational.h [code=c++] #ifndef RATIONAL_H #define RATIONAL_H class rational { public: rational(); … | |
Re: are you trying to do inheritance? If you are just declare your "nested" class with [code] class inner::public outter { [/code] | |
The google references were a bit varied and ambiguos and my textbook ironically doesn't cover templates ._. if I were to make [code=c++]template <typename typ> class stk { public: stk(); ~stk(); private: struct STK { typ dat; STK *lnk; }; *chn; int ctr; }; [/code] do I have to do … | |
Re: [code] float a=3.145698; float b=a; [/code] define b as a; if you only want 3.14, just set the float precision to 2. | |
Re: Does your variable need to mark where new lines are? If not, you can just append each line to the same variable. If you do, just ad a null character(or a character of your choosing) after each line prior to appending. | |
Re: factorial function: [code=c++] in factorial(int x) { int t; for(t = x; t >-;t++) x = x*t; return x; } [/code] I hope you read into function calling and creation. | |
Re: Your question is a bit unclear to me; but why do you need the type information? The best solution would be to grab the type prior to executing your script as lua uses dynamic typing anyways so it doesn't really matter if your arguments go in as a string, int, … | |
If I delete a pointer, does it delete the data in the current address or all of it? example: [code] bool *dat; dat=new bool; dat=true; ++dat; dat=false; delete dat; --dat; [/code] if I printed dat, would it return true or just a random address? | |
Re: I found it easier to use a 52 unit bool array, using the index as the unique card ID and the value to determine whether it is in the deck or not. i.e. a[2] would be a 3 of spades, if it is true, it is still in the deck, … | |
Re: Oh good god, I don't even know where to begin: -why do you need a goto statement? a loop would do just fine -you are closing a nonexistent brackets -42 is not the random number you generated -and you also have improper brackets -don't forget srand(time(0)); anyways, a simplified code … | |
Re: Do you need the original input? If not, you can just tolower()(or upper) the entire input, as it will do nothing if it is already lower(or uppercase). | |
Re: The nifty thing about ifstream is that it can open(and create) any type of file. That being said, you can have it prompt you for the file name and append .txt to the end or include .txt to the input. Just be sure to use a *char variable, as it … | |
Alright so I have a header file that includes another class with a pointer to a structure as a private variable. Does my second header have to be a pointer too or can it be static? [code=c++] #ifndef EXAMPLE1_H #define EXAMPLE1_H struct ex { int blah; char meh; }; class … | |
| |
Re: If you have ever played with legoes, you can build a machine; if you have a son, its kind of like a bonding experience(so mabe I'm exagerating) but neweggs IS having a sale, so you might want to consider it; besides, what can possibly go wrong? | |
Re: Urgh, I skimmed your code and noticed the abscence of string arrays, have you considered using them? They make comparison so much easier. The are declared in this format: [code=c++] std:: string array[4]; [/code] dont forget to include <string> If you gave me the code snippet of where you think … | |
Re: Your function is a bit, no way too complicated >_>, just keep one pointer to track the first link of your list and reference it when you want to print it. [code=c++] Node *list, *front, *temp; list = new struct node; front = list //your code here, do not modify … | |
Re: Rather than using: char *names[MAX]; do char *names = new char[MAX]; | |
Re: You shouldn't have to if you linked your compiler to them; if they came in that folder with your install, I wouldn't suggest moving them. | |
Re: [code=c++]struct list { //your structure Shape_data; Triangle_data; Square_data; list *link_front, *line_back } list *example; //initializing your pointer expample = new struct list; [/code] Not quite sure what you mean by including your class in a structure; honestly I would just make a class that inherits all three but the above … | |
Re: First, I'd like to say that although the effort is impressive, you are approaching this rather... crudely; there are a few things you can do to shorten your code(by A LOT). First of all, since your board is initialized to character '-', you can automatically assumed there will be nothing … | |
Re: Right off the bat you can see that there are two problems that will cause you a massive pain. The first problem being you dont have an cout<<endl; anywhere, how are you going to get to the next line? secondly, if you look at the pattern, you can see that … | |
Re: For the purposes of his project, the program wouldn't need to be nearly as comprehensive. That being said, some fun projects include: Random essay generator, graph constructor(make individual points, connect them, identify if they are a shape or on a single line ect, give information about shape(or line) i.e. perimeter, … | |
Re: I'm not familiar with servers but I if fork is anything like multithreading, it shouldn't affect the other process. As for the cin that doesn't bring your program to a halt, try the "GetAKeySyncState()" function from <windows.h>, but that only tracks key presses; if you play around with it you … |