Posts
 
Reputation
Joined
Last Seen
Ranked #3K
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
87% Quality Score
Upvotes Received
7
Posts with Upvotes
7
Upvoting Members
6
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
2 Commented Posts
~23.7K People Reached
Favorite Forums
Favorite Tags
c++ x 32
c x 11

30 Posted Topics

Member Avatar for MareoRaft

[QUOTE]just tried using fgets() (see below) but I run into message "warning: passing argument 1 of ‘fgets’ makes pointer from integer without a cast"[/QUOTE] fgets() requires an array of char for the first argument. [code] #include <stdio.h> int main() { char input[BUFSIZ]; printf("\nTo calculate a^b, enter value a now.\n"); int …

Member Avatar for MareoRaft
0
3K
Member Avatar for spankboy11

[QUOTE]Is this dynamic array procedure something that's not suitable for use with objects?[/QUOTE] Dynamic arrays work with objects, the problem is the value of the static variable Fuzzy::n. Destructors are only called if the memory is freed, so if you create an array of 10 in the first iteration of …

Member Avatar for Kanoisa
0
243
Member Avatar for darkmeyi0319
Member Avatar for dflatt
-2
159
Member Avatar for D_switch

celltype is wrong because the function is hashing the student ID. The list is irrelevant to that task. x should have a type of student instead. Concerning sum, first and foremost it must be initialized. The += operator uses the current value within sum and adds to it, if sum …

Member Avatar for Luther von Wulf
0
105
Member Avatar for jeevsmyd

[QUOTE]I have been advised by many people that it is better to use integer return type for main function instead of void ![/QUOTE] That is good advice if you want the code to be maximally portable without any changes. [QUOTE]I actually dont understand what return 0 means[/QUOTE] It means the …

Member Avatar for gerard4143
0
140
Member Avatar for harikrishna439

There are two logical parts to an array. The [B]capacity[/B] is set by the declaration. For the declaration [icode]int a[10];[/icode], 10 is the capacity. It is the maximum number of elements that can be stored in the array. The [B]size[/B] is the number of used elements in the array. Using …

Member Avatar for Ancient Dragon
0
177
Member Avatar for Stefano Mtangoo

My guess is that GetSymbol() returns a void*, and void* is not compatible with function pointers. Try a cast, you might get lucky. [code] helloSteve myFunc = reinterpret_cast<helloSteve>(myDLL->GetSymbol(wxT("helloSteve"))); [/code]

Member Avatar for Stefano Mtangoo
0
1K
Member Avatar for mrkaran

[QUOTE=mrkaran;1306567]if i have two strings say: string str1,str2; then how can i compare them by using strcmp function?[/QUOTE] The strcmp() works with C strings. The string class has comparison built in using both operators and the [URL="http://www.cplusplus.com/reference/string/string/compare/"]compare()[/URL] method. The compare() method is the closest match to strcmp(), but if you …

Member Avatar for NathanOliver
0
102
Member Avatar for algoexpert

The solution is to get a newer compiler and use graphics libraries that are better suited to Windows 7. Turbo C++ can probably be made to work through extreme compatibility, but it was written for Windows 3.1 and is so far out of date that new code should not be …

Member Avatar for Kakashi Hatake
0
139
Member Avatar for indr

floats can be used as a counter, but you must be very careful in comparing them because they are approximations of values and have inaccuracy where two values that seem the same are not exactly the same. A fuzzy comparison is usually used for floating point. Here is your code …

Member Avatar for Luther von Wulf
0
117
Member Avatar for jemz

There is no function to do this kind of numeric formatting, but one can be written. The hardest part is the group separation with commas. [code] #include <stdio.h> #include <string.h> #include <limits.h> #include <locale.h> #include <ctype.h> typedef enum { FALSE, TRUE } BOOL; BOOL format_numeric(char const* num, char* buf, int …

Member Avatar for jemz
0
117
Member Avatar for indr

In what way is it not working? The same code works ok for me. [code] #include <iostream> #include <iomanip> #include <string> using namespace std; int main() { string a = "hello"; cout<<"|"<< setw(10) << a <<"|"<<endl; } [/code]

Member Avatar for indr
0
443
Member Avatar for Luther von Wulf

This function reformats a numeric sequence to include grouping in the usual human readable format. "123456789" becomes "123,456,789", for example. The formatting is localized to the current running machine. In a German locale the previous example becomes "123.456.789". In a Hindi locale it becomes "12,34,56,789". Printing numbers for human consumption …

1
488
Member Avatar for ftl25

The parentheses around void seem to be the problem. Does this produce the same error? [code] struct { void (*function)(); const char* functionName; } lookUpTable[] = { {&TSL1_ReadMemory32, "ReadMemory32"}, {NULL, NULL} }; [/code]

Member Avatar for gerard4143
0
2K
Member Avatar for cesvokamra

Because of how RLE works, a run of two will not naturally be in the encoded string. You can use a run of two of any character as a special sequence that signifies the start of an encoded run for that character. In your example, "ABRTTTTOPSSSSSNU" becomes "ABRTT4OPSS5NU" with the …

Member Avatar for cesvokamra
0
118
Member Avatar for xavier666

[QUOTE]For any other object that is not the "this" object, protected members are inaccessible, just like if they were private, as far as Foo is concerned or any other derived class for that matter.[/QUOTE] What you say is not completely correct, for the following code compiles and runs. [code] #include …

Member Avatar for Fbody
0
115
Member Avatar for miturian

[CODE]connections[k++]=&(slot(ii,jj));[/CODE] This line is suspicious. If connections is a vector, then either it should be resized to have enough space beforehand, or push_back should be called to add a new element each time. Indexing does not resize the vector, that might be why the size is different from how many …

Member Avatar for arkoenig
0
185
Member Avatar for ziarczak

This is what is called a dependent type because the type of the vector size_type is dependent on is also dependent on a template argument. It is fixed with the typename keyword. [code] template <class Type> class Some { private: vector<Type> elements; typename vector<Type>::size_type index; public: Some() { } }; …

Member Avatar for Luther von Wulf
0
92
Member Avatar for furtaker

strcat_s() takes 3 arguments, not 2. And just like strcat(), a precondition is that the string is already zero terminated. Meet the precondition and supply the required arguments and it will work as expected. [code] person1.m_name[0] = '\0'; strcat_s(person1.m_name, 40, "Dan"); [/code] For initialization, strcpy() or strcpy_s() are better choises.

Member Avatar for Luther von Wulf
0
248
Member Avatar for hanvyj

[QUOTE=mike_2000_17;1303930]the (int) cast is from C, and is not recommended in C++ for good reasons. Use the "functional" casting: [CODE] //check the video info header Width = int(&pVideoInfoHeader->bmiHeader.biWidth); Height = int(&pVideoInfoHeader->bmiHeader.biHeight); //break point here [/CODE] [/QUOTE] The functional cast is still the same thing as the C cast, and it …

Member Avatar for Stefano Mtangoo
0
5K
Member Avatar for Allophyl

Did you prefix the name with the namespace? [code] std::nth_element(minRollArray, minRollArray+n, minRollArray+numSets); [/code]

Member Avatar for Allophyl
0
556
Member Avatar for Luther von Wulf

What are good name conventions for classes. How for example should the name be different between a base class and a derived class or an abstract class and a concrete class?

Member Avatar for mike_2000_17
0
184
Member Avatar for bmos

Looping over the string keep in mind that the code is looking for a single instance of the character type. Avoid breaking the loop until the end. Your code does not work because the first loop in verifyPass returns false if *any* of the characters in the whole string is …

Member Avatar for Anyzen
0
6K
Member Avatar for Luther von Wulf

What are some good exercises for an experienced programmer new to C++? I have found lists and suggestions on the web, but they are always simple or I have already completed them in other programming languages like C or Basic. Something that will help with learning modern C++ is best.

Member Avatar for mrnutty
-1
2K
Member Avatar for Auraomega

cell should not be dereferenced in the first call to malloc(), and the cast is missing a level of indirection. [code] cell = (s_cell**)malloc(sizeof(s_cell) * MAP_X); [/code]

Member Avatar for Aranarth
0
168
Member Avatar for Nulled

[QUOTE]if you want to make a gui program that is not all DOS, and command prompt, then why use C++[/QUOTE] You can say the same about any other programming language. Java for example has a GUI library, but it is not part of the language. You still have to learn …

Member Avatar for Yojimbo_Beta
0
229
Member Avatar for ichigo_cool

Cut off the upper end of the range to account for the addition. [CODE]rand() % (20-8) + 8[/CODE]

Member Avatar for mrnutty
0
240
Member Avatar for Qu4n7um

[QUOTE]1) Get a IDE, I suggest one of these, codeblocks or visual studio 2008.[/QUOTE] Visual C++ 2010 is better because it has parts of the newest C++ and the IDE is much improved. Visual C++ 2008 is still good, but if old projects do not need to be maintained then …

Member Avatar for ichigo_cool
0
185
Member Avatar for computerdummy30

What kind of help do you need? Are there errors that you do not understand?

Member Avatar for EngSara
0
88
Member Avatar for chade25

[QUOTE]I thought ffgets second argument would limit the input, but it doesn't. Any help is appreciated.[/QUOTE] fgets *does* limit the input. But only for the buffer argument to fgets. To print an error if there is more input than the buffer can hold, check for a new-line character at the …

Member Avatar for chade25
0
117

The End.