2,712 Posted Topics

Member Avatar for Phil++

Talk about classes, inheritance, polymorphism, generic meta programming, virtual and pure virtual functions, operator overloading... and also about the potentially bad problems like "multiple inheritance" and the ways to solve it.

Member Avatar for mrnutty
0
91
Member Avatar for mikesr

All you need to know is the slope formula, and how to create a mx+b line. Do you know how to do that?

Member Avatar for mikesr
0
286
Member Avatar for fedya

[QUOTE=death_oclock;1060270]Do you have the exact wording of the problem? You [I]cannot[/I] turn an unordered list into an ordered one without sorting it.[/QUOTE] Yep, not unless you obscure the meaning of "sorting".

Member Avatar for mrnutty
0
77
Member Avatar for mokia1

First define the showBoard. Maybe this will get you started : [code] void showBoard (char t[3][3]) { for(int i = 0; i < 3; i++) { cout<<"---------------------\n"; for(int j = 0; j < 3; j++) { cout << t[i][j] << " | "; } cout<<endl; } cout<<"---------------------\n"; } [/code] Then …

Member Avatar for mrnutty
0
112
Member Avatar for mrnutty

Since thanksgiving is soon here, I thought we would have our own daniweb feast, specifically an obscure feast. Remember that only obscure code is valid in our obscure table. I'll start : [code] #include<iostream> #include<string> using namespace std; ostream& ____ = cout; string _____ = "hello";string ______ ("world"); string _______ …

Member Avatar for Ene Uran
4
113
Member Avatar for Phil++

do you need to know the size of the char array? If so then add it to the set* prototype.

Member Avatar for mrnutty
0
152
Member Avatar for luskbo

What is wall? How do you have it oriented. Depending of the orientations of the wall, the collision detection will be easy or harder.

Member Avatar for mrnutty
0
661
Member Avatar for mokia1

>>it's not coming out right... can anyone help? I would but can you be more descriptive?

Member Avatar for mrnutty
0
72
Member Avatar for blahbla

[QUOTE=blahbla;1059807]yea thats not a compiler error message. you could say that its a remark, i guess the code i wrote doesnt do what it wants me to. but i dont understand what it wants. what i wrote looks right to me, but it says its wrong so its wrong.[/QUOTE] Is …

Member Avatar for blahbla
0
220
Member Avatar for Kennych
Member Avatar for m.a.u.

1. use win32 with directx 2. use win32 with opengl 3. use java with opengl. 4. make a wrapper of win32 in c++ of the things you need, and use either opengl/glut or directx

Member Avatar for m.a.u.
0
102
Member Avatar for foxmulder
Member Avatar for PDB1982

[QUOTE=PDB1982;1059448]I have to creat a program where the user inputs two large ints, and they are converted into string in order to add them together (assuming they are larger than 20 characters). One thing, is that it tells me to convert the numbers to a string and store it in …

Member Avatar for mrnutty
0
100
Member Avatar for sabian4k

>>but I want it to look like this. ** *** **** **** *** ** 1) Make a function called : printStar(int num); Where it prints num of stars : For example a call to printStar(4) would produce : **** or a call to printStar(2) would produce : *** After you …

Member Avatar for DaBunBun
0
171
Member Avatar for sfuo

did you try the red book? Alternativly, you give each object a unique color and easily go about selection from there.

Member Avatar for mrnutty
0
94
Member Avatar for HROFE

You don't. Use c++ clock() or if you are on windows, use queryPerformaceCounter.

Member Avatar for HROFE
0
41
Member Avatar for jacline
Member Avatar for misvampire

Int this class : [code] //This is the header file figure.h. using std::cout; class figure { public: virtual void center(); void draw(); void erase(); }; void figure::center() { cout << "Centering the Figure"; cout << "\n"; cout << "\n"; [/code] You should make draw a virtual function because you each …

Member Avatar for mrnutty
0
121
Member Avatar for Nikhar

The function uses the & operator. That operator makes a variable synonym. For example : [code] int num = 10 ; int &ref_num = num; ref_num = 4; //same as doing num = 4 [/code] So similarly, since this function : [code] istream& read(istream& is, Student_info& s)[/code] Take a look …

Member Avatar for Nikhar
0
2K
Member Avatar for Doughnuts
Re: Sigh

Before you open it, check if the file is already opened at your save function.

Member Avatar for bamcclur
1
113
Member Avatar for devo_99

your function prototype : [code] void Start(long remainder,long& countZero, long& countOdd, long& countEven);[/code] your function defintion : [code]void start(long remainder,long& countZero, long& countOdd, long& countEven)[/code] The 's' is not capitalize in the second one. Also I do not see any point for makeing this function. Also you forgot '&' before …

Member Avatar for devo_99
0
210
Member Avatar for PDB1982

using structs or classes would be easier and more elegant. What do you think?

Member Avatar for Clinton Portis
0
134
Member Avatar for murid

A picture or an image is made from a sequence of [URL="http://en.wikipedia.org/wiki/Pixel"]pixels[/URL].

Member Avatar for mrnutty
0
98
Member Avatar for John-5-

Disregarding the header and the bottom of the table and just considering the inside of the table you can simply just do this : [code] for(int i = Max; i >= Min; --i){ //print i //print '!' //print \t //prints (i)*(i-1)*(i-2)*...(1) //print factorial of i //print new line } [/code]

Member Avatar for mrnutty
0
130
Member Avatar for Trekker182

You cannot instantiate an abstract class. You cannot instantiate an abstract class. You cannot instantiate an abstract class. You cannot instantiate an abstract class. You cannot instantiate an abstract class. You cannot instantiate an abstract class. You cannot instantiate an abstract class. You cannot instantiate an abstract class. You cannot …

Member Avatar for Trekker182
0
146
Member Avatar for Darth Vader

[QUOTE=Darth Vader;1058335]I wonder if there is any function that returns the difference in minutes for examples like this: 1300-1515 (135 minutes) 2350-0100 (70 minutes) Is there any timefunction that can have the ability to return the minutedifference ?[/QUOTE] Are you sure those calculations are correct?

Member Avatar for Excizted
0
85
Member Avatar for T-Dogg3030

Just make a function that returns a random lowercase or a random uppercase depending on the parameter. Do you know how to generate random values ? [code] srand( time(0) ); //#include<ctime> needed for time function int randomNum = rand(); [/code] With that in mind generating a random character is easy …

Member Avatar for mrnutty
0
305
Member Avatar for NitaB

Can you use strings? Since you can access the string as an array with the indexing operator, [] .

Member Avatar for NitaB
0
708
Member Avatar for ganmo

This is when you can use a pointer that takes an refrence. Try adding this : [code] bool list_add(int (&list)[], int& space_used, int max_size, int value) [/code] Now list is an reference variable which happens to be an array. Also only incrementing max_size by 1 is a bad idea. Try …

Member Avatar for mrnutty
0
127
Member Avatar for Jelmund

>>PS: i already searched on the internet Then obviously you haven't searched at daniweb. Anyhow, do you first know how to generate a number from a min to max?

Member Avatar for zortec
1
236
Member Avatar for Jalwes
Member Avatar for Lerner
0
98
Member Avatar for noey699
Member Avatar for mrnutty
0
78
Member Avatar for icygalz
Member Avatar for n3r3d

This shouldn't be this hard. You want to read from a text file of the format : [code] Firstname;Lastname;178 [/code] where the ';' means the word has ended. And you know you will always read firstname, then lastname, then the value. Now first you need to open a file. Of …

Member Avatar for pecet
0
259
Member Avatar for Phil++
Member Avatar for BestJewSinceJC
0
164
Member Avatar for kfg20
Member Avatar for Lukezzz

>>Is there a way to delete the content on the left side of += after each loop ? Can't know for sure without knowing Fr->callEvent type, but Assumming callEvent is a string ? You can just reset it [code] for (int i = 0; i < 3; i++) { Fr->callEvent …

Member Avatar for Nick Evan
0
85
Member Avatar for Clinton Portis

Don't forget, that there are also other methods. For example, you can extract character by character. Here is an example of that : [code] #include<iostream> #include<string> #include<fstream> using namespace std; int main() { ifstream iFile("test.txt"); if(!iFile) return -1; char ch = 0; string content = ""; while(iFile.get(ch) ){ content += …

Member Avatar for mrnutty
1
195
Member Avatar for RThomasM

You can use the string's [URL="http://www.cplusplus.com/reference/string/string/find/"] find [/URL]method.

Member Avatar for RThomasM
0
203
Member Avatar for ninreznorgirl2

Normally, the delete function should look like this : [code] void deleteList(Node * headNode) { Node * temp = headNode; while(temp != null){ temp = head->next; delete head; head = temp; } } [/code] I think that should be correct.

Member Avatar for mrnutty
0
75
Member Avatar for mtusk

[code] #include<iostream> using std::cout; struct Test { int i; Test(int j) { i = j; } void show() { cout << i << "\n"; } }; int main() { Test test[3] = { Test(1), Test(2), Test(3) }; test[0].show(); test[1].show(); test[2].show(); return 0; } //prints 1 2 3 [/code] Of course …

Member Avatar for mtusk
0
119
Member Avatar for DaBunBun

when you download netbeans make sure you download the JVM as well. Are you creating the project correctly?

Member Avatar for DaBunBun
0
130
Member Avatar for tootaa

>>note the question ask to reprint the array but without any repeating number You can use the library sort method and then display the first element. Compare it with its adjacent, if different display it, and repeat.

Member Avatar for mrnutty
0
954
Member Avatar for jonathanYoung

Before I answer, can you show how you tried to do this, so I can get a better feel of what you are trying to achieve.

Member Avatar for Doughnuts
0
118
Member Avatar for pac-man

[QUOTE=mrPaul;1055325]Forgive me if im wrong but wouldn't this be a hell of a lot easier in an array? string itemsArray[x][y] itemsArray["pen"][1.99] or something to this effect? without writing some code to parse your alphanumeric string you're going to struggle how your doing it right now i think (imo)[/QUOTE] Wrong. You …

Member Avatar for mrPaul
0
317
Member Avatar for abhisheksingh11

For that you need to read multiple books, and even then you won't know everything. But to start out, C++ primer plus is a good book. It goes in details of C++.

Member Avatar for Sodabread
0
104
Member Avatar for swolll

What exactly do you need help with? A composition is when your class is composed of some object. Here is an example : [code] class Name { public : string aName; }; [/code] since string is a class and aName is an object, then one could say that Name is …

Member Avatar for jonsca
0
225
Member Avatar for Mr.Magic

Change this : [code] if (num > largest) largest = num; count++; [/code] to this : [code] if (num >= largest) { largest = num; count++; } [/code] And I think it should work.

Member Avatar for DaBunBun
0
290
Member Avatar for cole davidson

[QUOTE=cole davidson;1051636]Is there a way to do this without using arrays?[/QUOTE] Yep I guess, you can use if statements to sort this.

Member Avatar for cole davidson
0
171
Member Avatar for Ciganjo

What you should have is make the Product class composed of an another class. The another class should hold all the data thats needed, like name or barcode. Then you can use that as a parameter to in createNewProduct. Is your createNewProduct creating a temporary(initialized to the parameters passed) variable …

Member Avatar for mrnutty
0
136

The End.