1,288 Posted Topics
Re: https://developer.apple.com/library/ios/recipes/xcode_help-structure_navigator/articles/Adding_an_Existing_File_or_Folder.html | |
Re: Yes. You'll find it easier to use a library than to do it all yourself. There are some listed here: http://en.cppreference.com/w/cpp/links/libs There are many more out there. | |
| |
Re: Our very own Viking Mike has an answer (with a nice flow chart) on this stackoverflow page: http://stackoverflow.com/questions/471432/in-which-scenario-do-i-use-a-particular-stl-container | |
Re: int Nmbr; int Bal; char Stat; cin >> Nmbr; cin >> Bal; cin >> Stat; Account Nmbr; This code seems to attempt to create an int named Nmbr and also an Account named Nmbr. This makes no sense. You cannot give two different objects the exact same name. Are you … | |
![]() | Re: str1 is effectively a pointer. A pointer is a memory address. In this case, it's the memory address of the first char in the array of char created on line 5. str2 is effectively a pointer. A pointer is a memory address. In this case, it's the memory address of … ![]() |
Re: Jeff Prosise wrote a couple of good ones back in the mid-nineties. They're very good for understanding MFC. | |
Re: ` if (number) { // Check if the input is a number. ` This does not check that the input is a number. Not only because at this point there has been no input, but also because it will attempt to turn `number` into a bool and test it for … | |
Re: Most of your errors involves trying to use member variables but not stating which object they're from. For example: friend ostream& operator<<(ostream& os, const property& dt) { if(getf==NULL && setf==NULL) //error these don't make sence to me :( os << dt.PropertyValue; else if (getf!=NULL) os << getf(); else return 0; … | |
Re: As a rule of thumb, every textbook won't cover every member function in the C++ standard library (not least because it's huge). For that sort of thing, look at a dedicated reference, such as: http://en.cppreference.com/w/cpp/string/basic_string There's `find`, towards the bottom. It's completely standard and there's nothing wrong with it. If … | |
Re: It may be easier to use one of the many common widget libraries; some of them have very simple interfaces for playing sound, and the library takes care of the heavy lifting involved in interfacing with your operating system. | |
Re: ` Dictionary *dict = create_dictionary ;` Did you mean ` Dictionary *dict = create_dictionary();` ? | |
Re: The solution is to use a modern IDE. There are many free modern IDEs available. | |
Re: They're used by the preprocessor to replace things in your code with other things (including replacing things with blank space - effectively just removing them). http://www.cplusplus.com/doc/tutorial/preprocessor/ assert() is a function. http://www.cplusplus.com/reference/cassert/assert/ NDEBUG is a macro that may or may not be `#define`d somewhere. If your code contains: `#define NDEBUG` the … | |
Re: **.h file** Missing semi-colon at end of line 20 **impl file** Remove semi-colon from end of line 6 Operator is wrong on line 12 (>=) Missing semi-colon on line 14 Does the function getElement return something or not? If it does, its return type should not be void. If it … | |
Re: Insert a photo into what? | |
Re: So what's the problem? It makes no sense to say that you can do it easily using a class but not like this. The functions in your class would be almost identical. If you've done it with a class, you're almost done. Leave every member variable in the class, change … | |
Re: Do you know how to declare an int? | |
Re: Perhaps this rewrite makes it clearer. Braces make code easier to read. void acceptCharacter() { cout<<"Enter a character: "; cin>>inp; if(inp>='A') //ASCII value of A = 65 { if(intp<='Z') //ASCII value of Z = 90 { cout<<endl<<"Uppercase"; } else if (inp>='a') //ASCII value of a = 97 { if(inp<='z') //ASCII … | |
Re: This being C++, you might consider using a container that does deduplication for you. A std::set comes to mind. If you use a std::set of strings to store your strings in, instead of an array of strings, when you're done adding your strings to it, there are no duplicates. | |
Re: > I'm unable to figure out the actual dimension of the array and its lenght as the variable size is only declared not defined; meaning it has not been assigned any value yet. It still has a value; just not one assigned by you. The `int` named "size" occupies some … | |
Re: A pointer is just another kind of variable, used for holding another kind of information and you can perform operations on that information. There's no reason to think of it differently to how you think about an int, or a double, or a float, or anything else. Why is an … | |
Re: A reference is another name for some variable; when you use the reference, you're using that exact same other variable. A reference is an alias, if you like. `int &length;` In this case, what other variable is "length" another name for? None. It makes no sense. `int &length = 0;` … | |
Re: ` HardwareRecord temp;` It doesn't know which constructor you mean to use to make this object. The default one (`HardwareRecord::HardwareRecord()`), or the one that takes four parameters that all have default values. Looks like the easiest fix is to remove the default constructor. | |
Re: While there is nothign at all wrong with doing the heavy lifting yourself, C++ comes with a nice standard library; if you read all the numbers from both files, and as you read them insert them into a std::set, when you're finished reading, the set is ordered and contains no … | |
Re: What about it don't you understand? It's quite simple. Client sends username and password to server, server checks it matches the record. You can make it more fancy by having the password records hashed and salted for security, and have what the user sends encrypted to thwart eavesdroppers, but there's … | |
Re: Does an instance of the class have to be exactly ten bytes always, or do you actually just need to make an int class that can handle 2^80 possible values (i.e. 10 bytes' worth of values)? | |
Re: `What should I search for in my code in order to find the problem?` You should look at the line number that the error messages tell you and use that to identify the line in the code that it doesn't like. You're declaring the same variable, w, in more than … | |
Re: It's not enough to just include a header. You have included a header, which tells the compiler enough basic facts about the function named `CkFtp2::put_Username` to know what its name is, what input parameters it takes, and what return it gives. The compiler has enough information to essentially put a … | |
Re: First, you're doing yourself no favours by using a compiler from twenty years ago. C++ has moved on a long way since then, and you'd be much better using a recent compiler. Anyway, you're trying to create a Vector2D object using this function: `Vector2D a(a1, b1);` This is a constructor … | |
Re: Try ` t[i] = teacher(name,code,sub,pub);` and similarly for others. While I'm here, you've got variable length arrays, which are illegal in C++ and your compiler really shouldn't let you have that, and you're using char arrays where proper string objects would be better and easier. | |
Re: You're trying to use a constructor that doesn't exist `Point2D(int,int);` I'd guess you meant to write something like: Point2D::Point2D (int xVal, int yVal): x(xVal), y(yVal) {} | |
Re: for (int i = 0; i<1; ++i) { cout << "3" << endl << "6 6" << endl << "9 9 9" << endl; } | |
Re: You're treating everything there as a pointer. They are not all pointers. | |
Re: `strList[a]` is a char\* that you never set. It could be pointing anywhere in memory. It will almost certainly be pointing at memory that the operating system doesn't want this program touching, so it kills it with a segFault. ![]() | |
Re: Files: http://www.cplusplus.com/doc/tutorial/files/ Sort: http://www.cplusplus.com/reference/algorithm/sort/ Displaying: http://www.cplusplus.com/doc/tutorial/basic_io/ | |
Re: While we're here, I see that you're comfortable using C++ string objects in your code. Why use a char array for `str` rather than a C++ string? | |
Re: An array is guaranteed to use contiguous memory (i.e. no gaps between the elements). A struct has no such guarantee; the compiler can choose to put padding between the members for ease of memory access. https://en.wikipedia.org/wiki/Data_structure_alignment#Typical_alignment_of_C_structs_on_x86 As it happens, typically a float is the right size for memory alignment and … | |
Re: I'm making the assumption here that your actual command line is "project1.exe test.dat", and that project1.exe is the executable made from the code above, and that the file "test.dat" contains the text "cat dog cat dog". Your code (whilst using a compiler from two decades ago - iostream.h and other … | |
Re: The short answer is yes. The longer answer is if you're doing GUI programming, I recommend you use a decent cross-platform GUI library such as QT, which is heaving with functions to do things like showing windows and reading text from them. | |
Re: `i` is not a number. It's an iterator. Either cycle over the deque using numbers: for (int i =0; i< SpriteList.size(); ++i) { SpriteList[i] ... ... } or dereference the iterator to get at its contents: for( auto i = SpriteList.begin(), end = SpriteList.end(); i != end; i++ ) { … | |
Re: Is that ab^(4c^2-d/m-n) or ab^4c^(2-d/m-n) or ab^(4c^2)-d/m-n or ... or .. or ... or ... There are a billion ways to interpret that. ![]() | |
Re: Well done, although this sort of thing is usually done over in the "Introductions" forum, over here: http://www.daniweb.com/community-center/community-introductions/165 :) | |
Re: You're right; this is going to cost you some time. It's always worth using some profiling tool to double-check where the time is being taken in your code (it is very, very common for people to think they know, and to spend a lot of effort optimising their code how … | |
Re: This is very dependent on your operating system's console. What operating system are you using? | |
Re: Inside a function, the following variables exist: 1) Parameters you passed in 2) Any variables you create inside that function. 3) Any global variables that exist everywhere. `ranum` is none of these, so it does not exist inside the function `loop`. | |
![]() | Re: ` stackArray = new int[stackSize];` should go in your constructor so it's done only once, when you create the stack. At the moment, you're recreating the stackArray every time you push something. Your question is awfully vague. What in particular are you struggling with? ![]() |
Re: Works fine for me. What compiler are you using, and how are you running it? | |
Re: This is your code. int count = 0; do { for( int i = 0; i < 4; i++ ) { count++; } cout << count << ‘ ‘; } while ( count < 10 ); What's not clear about this? | |
Re: > what is wrong ?? `#include <iostream.h>` Back in 1998, the C++ standard came in and iostream.h definitely went out. If your compiler accepts this, throw it away and get one from this century. `#include <conio.h>` This is non-standard in so many ways, and many C++ compiler installations don't have … |
The End.