Posts
 
Reputation
Joined
Last Seen
Ranked #1K
Strength to Increase Rep
+6
Strength to Decrease Rep
-1
72% Quality Score
Upvotes Received
3
Posts with Upvotes
2
Upvoting Members
3
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
3 Commented Posts
~32.3K People Reached
Favorite Tags

63 Posted Topics

Member Avatar for sillyboy
Member Avatar for Kadence
Member Avatar for Dio1080
Member Avatar for avi_2009

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.

Member Avatar for mahatmagaga
0
173
Member Avatar for NordCoder
Member Avatar for SeeTheLite

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(); …

Member Avatar for SeeTheLite
0
85
Member Avatar for group256

are you trying to do inheritance? If you are just declare your "nested" class with [code] class inner::public outter { [/code]

Member Avatar for Sky Diploma
0
146
Member Avatar for nova2177
Member Avatar for SeeTheLite

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 …

Member Avatar for SeeTheLite
0
97
Member Avatar for hardikvd

[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.

Member Avatar for mrnutty
0
89
Member Avatar for iamsmooth

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.

Member Avatar for iamsmooth
0
97
Member Avatar for xfreebornx

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.

Member Avatar for mrnutty
0
115
Member Avatar for jarrax

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, …

Member Avatar for Lerner
0
92
Member Avatar for SeeTheLite

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?

Member Avatar for kvprajapati
0
97
Member Avatar for yasaswyg
Re: HELP

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, …

Member Avatar for Hiroshe
0
181
Member Avatar for jake43

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 …

Member Avatar for SeeTheLite
0
104
Member Avatar for kz07

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).

Member Avatar for SeeTheLite
0
109
Member Avatar for spursfc

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 …

Member Avatar for SeeTheLite
0
91
Member Avatar for SeeTheLite

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 …

Member Avatar for Ancient Dragon
0
63
Member Avatar for Ancient Dragon
Member Avatar for eowyn0622

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?

Member Avatar for MosaicFuneral
0
169
Member Avatar for waldchr

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 …

Member Avatar for waldchr
0
79
Member Avatar for TheFueley

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 …

Member Avatar for TheFueley
0
185
Member Avatar for mhaviv
Member Avatar for moosoo

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.

Member Avatar for SeeTheLite
0
71
Member Avatar for Carrots

[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 …

Member Avatar for Intrade
0
126
Member Avatar for devfolarin

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 …

Member Avatar for SeeTheLite
0
85
Member Avatar for RoselineM

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 …

Member Avatar for DangerDuke
0
128
Member Avatar for phalgun_g

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, …

Member Avatar for MosaicFuneral
0
161
Member Avatar for Barefootsanders

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 …

Member Avatar for Duoas
0
130
Member Avatar for jschri4

Where exactly does it not work? Also, I do not see casting anywhere, or where you are getting your floats for that matter; are you converting your strings to floats? I would use the <sstream> class to extract floats personally but frankly I'm a bit befundled by your code.

Member Avatar for SeeTheLite
0
175
Member Avatar for rEhSi_123

Its minor but it bugs me, change success from an into to a bool type variable and toggle it true if the password is correct, that way you can just write [code=c++] if(login()) PrintMenu(); else return 0; [/code]

Member Avatar for SeeTheLite
0
5K
Member Avatar for iTsweetie

As for commas, you can reverse your string, push it into another string, which adds a comma every three digits after the second, and reverse it again, so a theoretical ammount of $123456.78 would first go to 87.654321 87.654,321 123,456.78 alternatively, because you know there can only be one comma, …

Member Avatar for iTsweetie
0
138
Member Avatar for blahblah619

If you just want to use a letter, use the variable "char." Also remeber that characters are enclosed in single qoutes( ' ), and strings in double quotes (" "). You also need to include <string> for strings if you aren't using Devc++ as a compiler(which includes string under iostream). …

Member Avatar for SeeTheLite
0
3K
Member Avatar for Falkoner1

No, you only delete the first node, the proper way to do it is: [code=c++] while(node->next != NULL){ //node is the start of your list rec = node; //rec is used to keep track of node node = node->next; //move node to next link delete rec; //delete previous link } …

Member Avatar for Falkoner1
0
170
Member Avatar for mimis
Member Avatar for Nemoticchigga

you can also do it like Jenca's second suggestion like: [code=c++] foo *test; foo = new struct foo[10]; [/code]

Member Avatar for MrSpigot
0
116
Member Avatar for Barefootsanders

Er, yes you can use functions and manipulate classes in a structure; just remeber to refer to them properly i.e. list->class1->function();

Member Avatar for SeeTheLite
0
115
Member Avatar for zaohin

Sounds like a fun project, it will be much more rewarding if you come up with it on your own :)

Member Avatar for ithelp
0
104
Member Avatar for ganmo

well this is quite easy and can be done in multiple ways; the first is to use a bool array with as many integers as your highest input and toggle it to true if a number occurs, however, this is very inefficient. A better method would be to create another …

Member Avatar for ganmo
0
128
Member Avatar for rouba

Ironically I just wrote a merge sort program for queues a few days back, I'll send it to you tomorrow when I'm at school.

Member Avatar for ithelp
0
188
Member Avatar for myboo11009

Holy Necro Bump Batman, make a new thread and I'll see what I can do for you.

Member Avatar for ithelp
0
1K
Member Avatar for Dragonsfire
Member Avatar for jimjohnson123

Im not quite sure if I'm right, but you can't delete those integers because they are static.

Member Avatar for ArkM
0
146
Member Avatar for power_computer

Heres a basic snippet [code=x++] while(exit == false) flag = true for(x = 0; x = length-1; x++) //length as in actual length; for a[5] it is 4 if(array[x] < array[x+1]) { temp = array[x]; array[x] = array[x+1]; array[x+1] = temp; } for(x = 0; x < length-1; x++) if(array[x] …

Member Avatar for GDICommander
0
98
Member Avatar for lancevo3
Member Avatar for SeeTheLite
0
271
Member Avatar for TriniBabe

Heh, sorry but I'm about as useful as a hobo when it comes to graphs, as for linked lists, the basic format is: [code=c++] struct list { int data; list *link; }; [/code] basically you create a list *a and link it to another list variable with *link inside list. …

Member Avatar for DemonGal711
0
110
Member Avatar for power_computer

the problem is you do not have an accumulator, this revised code should work [code=c++] int Range (int start, int end, int divisor) { int range, counter, sum; sum=0; for (counter=start; counter<end; counter++) { sum= sum + counter; } range = sum / divisor; return range; } [/code] note I …

Member Avatar for power_computer
0
166
Member Avatar for cpsc1892

Well you can make a sort function, alternatively you can sort your inputs prior to pushing them into an array with a sort() function included in <algorithm.h>, but I doubt this is what your professor wants you to do. I suggest using a recursive function for sorting. oh and although …

Member Avatar for cpsc1892
0
2K
Member Avatar for power_computer

The End.