1,358 Posted Topics
Re: [QUOTE=thriek;1189581]ok I'm confused... my class is empty, apart from an inclusion file, but has alot of errors that i cant understand.... Here's the .h file: [CODE] #ifndef creator #define creator #include "stdafx.h" class creator { public: creator(); ~creator(); } //<------------ syntax error: a semi-colon is required here. #endif [/CODE] <snip> … | |
Re: [URL="http://www.daniweb.com/forums/announcement8-2.html"]What have you done so far? We're not going to do your final project for you.[/URL] | |
Re: I'm not real sure what your question is. Are you trying to separate the names as you input them? Separating them is the easy part. The hard part is managing the data after the input. I think you could do something with nested loops and a vector of strings. Keeping … | |
Re: That is what the issue is. Multiple #includes on standard headers aren't a problem, its the the multiple #includes on the custom "vehicle" headers that is the problem. The OP either needs to add header guards or change their inclusion structure to eliminate the redundancies. | |
Re: Inheritance could also be referred to as "specialization" or an "x [B]is a[/B] y" relationship. For example, a Cat is a "specialized" type of Mammal: What are some things that define a Mammal? Two common ones are "isHairy" and "isWarmBlooded", among others. What are some things that define a Cat? … | |
Re: You might need to use a dynamic allocation which would then require delete[]. I don't think the compiler will let you do that the way you have because I don't think [iCODE]strlen(msg)[/iCODE] is technically considered a constant. It looks like you want to copy the message before sending it to … | |
Re: What is the "something weird"? What you have posted won't compile because you didn't provide the "logic.h" header file... I suspect it's something like: n a m e 1 0 a v g e g r e y n n a m e 2 0 d h i n f … | |
Re: Based on what I see, you won't want a const. Are you familiar with the terms "arguments" and "parameters"? | |
Re: Where and how you initialize them depends on the structure of the program. How much of that structure did the prof give you, and what changes did you make? It may be easiest if you post the given structure as a reference. That would allow us to see your changes … | |
Re: [QUOTE=jwenting;1188053]Those are pretty clear compiler errors. I'd suggest you try to resolve them, and ask specific questions about them if you can't figure out how to go about that.[/QUOTE] I agree.... @OP: [URL="http://www.gidnetwork.com/b-38.html"]I suggest you re-evaluate your formatting and work on readability.[/URL] It appears that you are not matching up … | |
Re: Considering your filenames, you are probably compiling as C instead of C++. C does not support classes, only C++ does. You will need to change your source filenames from (*.c) to (*.cpp). Also, try changing your class name and file name to something else such as "myStack" or "manualStack". Once … | |
Re: What compiler are you using and what is the specific error that you are getting? | |
Re: How do you start every C++ program? You should know how the various loops, relational, and logical operators work by now. Figure it out... [URL="http://www.daniweb.com/forums/announcement8-2.html"]Unless you don't know anything because you've been sliding by...[/URL] | |
Re: Nice first post... :yawn: [URL="http://www.daniweb.com/forums/announcement8-2.html"]Welcome, and good Luck with that.[/URL] (I suggest you read the link.) | |
Re: I'm not familiar enough with .NET to know the exact operator(s) you need, but as I understand things, "String^ line" is a pointer to a string, it is not an actual string. Try to de-reference the pointer when you do your comparison. That's just my 2-cents. Take it how you … | |
Re: [QUOTE=3cats;1177824][CODE]{ if (AcctType == 'c' && CurrentBal < MinBal) CurrentBal -= CHK_SERV_CHRG;[/CODE][/QUOTE] The structure of your if statement itself is not correct. As a result, the else is not associating with it properly (it's a technical thing, I won't confuse you with it). The opening brace should be after the … | |
Re: Wasn't sure if this was relevant here or if I should start a new thread... Is there a new thread restriction for new members that I'm not aware of? [URL="http://www.daniweb.com/forums/post1176071.html#post1176071"]This post is a hijack attempt[/URL]. The user claims the forum won't let him start a thread... I told him how … | |
Re: I'm guessing you're talking about the while on line 29? As you have written it, you are attempting to compare the values stored in the variables named [I]response[/I] and [I]no[/I]. The problem is that the variable [I]no[/I] does not exist. Based on what I see, you should consider re-writing the … | |
Re: [QUOTE=LevyDee;1182353]Yes, except your loop parameters are going to be != instead of /=. /= is not a valid operand. And your pipes are going to be || instead of |.[/QUOTE] Actually, '/=' is a valid operand. The statement "[ICODE]x /= y;[/ICODE]" is shorthand for dividing x by y then saving … | |
Re: [Bubble Sort](http://www.sorting-algorithms.com/bubble-sort) is a very simple algorithm. What seems to be the issue? What kind of [research](http://www.lmgtfy.com/?q=Bubble+Sort) have you done? Other than building a program shell, [what have you done](http://www.daniweb.com/forums/announcement8-2.html) so far? Oh, and [use code tags](http://www.daniweb.com/forums/announcement8-3.html)... | |
Re: My eyes are bleeding. I can't comprehend this wall of text. I think you want us to do your homework for you ([URL="http://www.daniweb.com/forums/announcement8-2.html"]which won't happen[/URL]), but I can't tell..... | |
Re: Other than the fact that your first example didn't use classes at all, you did fine. An example class: [CODE] //class.h file //an example class class exampleClass { private: int memberInt; protected: public: exampleClass() : memberInt(0) {} //default constructor exampleClass(int newMemInt) : memberInt(newMemInt) {} //specified constructor ~exampleClass() {} //destructor void … | |
Re: [QUOTE=Robert1995;1176813]if you're planning to do it with switch it will be a pain [CODE]#include <iostream> using namespace std; int main () { int i; cout<<"Sigh ";cin>>i;cout<<endl<<"Answer : "; if(i>=70 && i<=100)cout<<"A"; if(i>=60 && i<=69)cout<<"B"; if(i>=50 && i<=59)cout<<"C"; if(i>=40 && i<=49)cout<<"D"; if(i>=0 && i<=39)cout<<"F"; if(i<0 || i>100)cout<<"Not Good"; }[/CODE][/QUOTE] [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]I suggest … | |
Re: I don't like it either way, because I can't read it. Code tags are used [CODE] ... your code here ... [/CODE]. Or, you can just click the CODE button in the posting toolbar. I suggest you edit your post within the next 15-minutes to correct the tags. [edit] ACK!! … | |
Re: Looks like you could do it with another if and a counter variable. Just make sure that the second if is also part of the for loop. And please use [URL="http://www.daniweb.com/forums/announcement8-3.html"][B][noparse][CODE=syntax] ... code tags ... [/CODE][/noparse][/B][/URL]. They make your code easier to read. I suggest you read [URL="http://www.gidnetwork.com/b-38.html"]an article about … | |
Re: This is a very generic question, don't count on much help until you provide some specifics and give us an example of what you've done. This is spelled out quite clearly in the [URL="http://www.daniweb.com/forums/announcement8-2.html"]homework-related announcement[/URL] at the top of the thread listing. What do you know about classes? | |
Re: Didn't you ask this in [URL="http://www.daniweb.com/forums/thread272654.html"]your other "newbie" thread[/URL]? You have to compare to the word in your original word array, then place the character in the proper location in your "word_to_guess" array. If you assume the secret word is "freedom" and the user enters 'r' your loop would loop … | |
Re: [CODE]template <class T> class Objvar;[/CODE] C++ is case-sensitive. Try fixing your forward declaration. | |
Re: You seem to be trying to shift array elements 1 element to the left. The second version is a better concept, but doesn't work how you think. The net result is no change, you'll just be copying the contents of an element back into itself. There is no change, because … | |
Is there an issue with the Site Search? It doesn't matter what search terms you enter it comes back with: [QUOTE=Site Search Response]Sorry - no matches. Please try some different terms[/QUOTE] To test, I did searches for "bit-fields", "bit fields", "bits" and that was all that I could get. I … | |
Re: Can you give us a better use case or some sort of algorithm? It almost sounds like you want some sort of [URL="http://www.cplusplus.com/reference/stl/map/"]map[/URL], but your post is a little confusing... | |
Re: There's not really enough here for us to tell how you are currently doing things. I think you might want to do something with parallel arrays. At minimum, have an array with the secret word and an array to track the revealed letters. Or is that what you are already … | |
Re: Where do you get tamount from the user? All I see is a declaration without any sort of input or initialization before you write it to the file. This causes the variable to have a really weird value in it (a.k.a. "garbage"). In your browser, do a find with "tamount" … | |
Re: Did you look in your other 2 threads concerning these questions? I told you how to generate the die faces in [URL="http://www.daniweb.com/forums/thread271936.html"]your "generate random number" thread[/URL]. To generate die faces you would take a random number modulus 6 (which generates 0-5) then add 1 (which shifts it to 1-6). This … | |
Re: By default, Dev-C++ uses the MinGW compiler which is a pretty good compiler. I used to use Dev, but the problem I had with it is that, yes the interface is nice, but many of it's subsystems are not very well implemented. I don't really recommend it. The debugger is … | |
Re: Since moveNumber is a reference parameter, you should just be able to simply add a line to main(), immediately after the call to move(), that outputs moveNumber just like any other output sequence. | |
Re: Try changing line 35 to [iCODE]if ($flag == 1)[/iCODE]. You might need to change line 44 to some sort of elseif as well. | |
Re: It sounds to me like you need header guards in place as well. That way, if a specific header somehow gets #included more than once, the various instances of it aren't butting heads and you only get one set of definitions. [CODE] #ifndef HEADER_FILE_NAME //check for previous inclusion #define HEADER_FILE_NAME … | |
Re: You need to send system() a string. Put [COLOR="Red"]c:\\new\\ram.bat[/COLOR] in double-quotes. | |
Re: Do a google search, then START YOUR OWN THREAD. Don't hijack, your topic isn't even related to the OP... | |
Re: All I see is someone barfing out a bunch of improperly-posted code and pleading for help... 1. Use [URL="http://www.daniweb.com/forums/announcement8-3.html"][B][noparse][CODE]...code tags...[/CODE][/noparse][/B][/URL] (click for more info) 2. Properly describe your problem. Without a description, all we can do is take a shot in the dark. I see alot of mismatched braces ('{' … | |
Re: I know this is a bit of a "me too" post, but I thought I should clarify daviddoria's response. strlen() only works with C-style strings (null-terminated arrays of [B]char[/B]s). Since you are working with C++ std::strings you can not use it as you have. You need to use the member … | |
Re: [QUOTE=some;1175109]hello, it could just be with the placing of the function. Maybe you should try moving it around. I don't know it looks fine to me...[/QUOTE] Other than the fact you can't do this? [CODE]cout << ((turn_it_is%2)==1)?(play1:play2) << cout << " it's your turn ";[/CODE] Or that the variable name … | |
Re: Create another series of loops similar to your input loops. Just convert them to output and perform the necessary arithmetic operations inside them. | |
![]() | Re: The way you wrote it is ambiguous. It could be a recursive reference to itself (which is technically undefined) or a call to one of the compiler's included pre-defined versions of the operator. Either way, I suspect that it does not match your intent. I'm not sure if it will … ![]() |
Re: [QUOTE=some;1175099]here is the code for generating random numbers [CODE]int which_Num; unsigned seed = time(0); srand(seed); which_Num = rand() % 5; [/CODE] The number 5 is the max number to be generated you can change it to whatever you need like 100 or 50 or in your case 6. After that … | |
Re: When you pass information into a function you do "make a copy of" the data. In that sense, you are correct. However, this is where you are incorrect: When you have an argument passed as a reference, or are passing in a pointer, the information passed/copied into the function is … | |
Re: [QUOTE=Nick Evan;1171719]I actually had to use babelfish to find out if you were making fun of my English :icon_neutral: . But: nice one! :)[/QUOTE] :confused: Your English seems really good to me... where are you from? I figured you were, at least, from an English-speaking country.... PS It took me … | |
Re: [B]delete[/B] is the keyword for dynamic [B]de-[/B]allocation of memory. I see no [B]new[/B] creating a dynamic allocation, so it is not needed. It is used with pointers, and I don't even see any pointers. | |
Re: I know absolutely nothing about win32API and DirectX but... The keyword "new" generates a pointer to the specified class. How is the variable DirectX defined? Is it some sort of pointer, and if so, is it the correct type of pointer? |
The End.