138 Posted Topics
Re: First off, in C, there is no built-in string data type. Therefore, string is represented in an array of characters. The null terminator depicted by a \0 (backslash zero). It is the way of telling where the string ends. Recursion means a function keeps calling itself until the termination case … | |
Re: Usually, one would get the list of applications running and check if a particular application is in the list. In your case, you may want to check whether "firefox.exe" is running (or any other browsers). Once detected, kill the process and the browser will close. [B]NOTE:[/B] It may be too … | |
Re: In your MAIN CPP FILE, you only need to include the declaration header file (.h) for your vehicle. That is sufficient for you to use the 'vehicle' class. You do not have to include the implemenation file (.cpp) in your main file. The compiler is smart enough to find the … | |
Re: Do note that your filename variable is in the loop; which will make the name keep on expanding. E.g. data1, data12, data123, ... You have to reset it to "data" after the output stream is closed. Also, you need to append the file extension name (in your case, the .txt) | |
Re: Use the built-in function sizeof() to get the size of your class in bytes. [CODE]// prints out the size of 'myClass' in number of bytes cout << sizeof(myClass)[/CODE] | |
Re: You can remove the destructor; ~Node(); since you are not implementating it. In this case, the compiler actually generates the default destructor for you. However, if you want to customize your destructor, do add in your implementation as in: [CODE]~Node() { // your code goes here }[/CODE] | |
Re: Use the cin.getline() function instead of cin. Your code should look like this. [CODE]cin.getline(str, max)[/CODE] | |
Re: It seems like you are learning the basics of C++. Do go through these sites for a good walk through tutorial. [URL="http://www.cprogramming.com/tutorial.html"]http://www.cprogramming.com/tutorial.html[/URL] [URL="http://www.learncpp.com/"]http://www.learncpp.com/[/URL] Happy Learning C++ | |
Re: It seems like you want to format your output in a more presentable manner; by spacing. This link may be useful. [URL="http://www.informit.com/articles/article.aspx?p=170770"]http://www.informit.com/articles/article.aspx?p=170770[/URL] | |
Re: I agree with adatapost suggestion. Always try to pass the value of the textbox from form.cs to your new class. Do not try to access the value directly (even though you can do that). It will eventually breaks the concept of encapsulation. Try to pass your variables through method call … | |
Re: For myself, defining a pointer means careful handling of memory to prevent leakage. Memory allocation and memory releasing have to be handled manually in C++, unlike managed code. When you have a pointer, remember to free up the meory when they are no longer needed. However, do keep in mind … | |
Re: It depends on the IDE you are using. In MS Visual Studio, add your DLL to in the project settings. Add it to the linking library in order to use the DLL. Do correct me if I'm wrong. | |
Re: It is never wrong to start learning C when you want to pick up C++ skills. After all, C++ is the superset of C. Through this, you will be able to differentiate between both of them. For 'true' and 'false' are not defined in C language, you may want to … | |
Dear members, I am looking for .NET functions to change power settings of a PC. For example, the hard disk turn off time, screen brightness, monitor turn off time. All these are intended to save energy. After some studies, I found that [B]DeviceIOControl[/B] provides such capabilties. However, I am not … | |
Re: If you want to keep track of the visited coordinates, you will need to keep a 2D array of a map for flagging. Mark each position once you have visited that spot. Please bear in mind that you may still need to revisit a coordinate in order to find the … | |
Re: Lookup for the function setWindowTitle() | |
Re: Here is a simple idea. 1. Arrange your strings in the text file so that the program can easy parse the strings into questions and options (e.g. separate them by line) 2. Define struct to store your set of questions and options (e.g. there are some examples already posted) 3. … | |
Re: If you do not explicitly define a constructor for your class, the program will call the default constructor. This is not recommended as your variables will contain random value. Constructor and destructor are highly recommended to carefully handle memory (constructor - to initialize values of variable before they are used) … | |
Re: hey FirstPerson, where did you found the algorithm? Is it proven and works on any other number? Regards, Nick | |
Re: Agree with MosaicFuneral, it is recommended to use ShellExecute() if you're in Windows. | |
Re: When working with std::string only, I recommend to use the equal sign to copy one string to another. Usually I would use strcpy only when I'm caught in a situation dealing with char array and std::string. Is this the right way of using strcpy? Can anyone give some good advice? … | |
Re: Hi invisi, The problem is obvious. Do remember this rule. Use delete when you have use a "new". In your case, you did not "new" a variable. You are merely assigning the pointer to another variable. As a matter of fact, this cannot be deleted. If you are using the … | |
Hi all, I am having trouble trying to load contents on a tab in accordion on the fly. Which means, the content for a particular tab will only be loaded and displayed when user click on it. Is there any example available? I am still trying it with Ajax. I … | |
Hi all, I have a piece of program written in Visual C++ which works just fine in Win XP. However when its run in Vista, the error message "A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available." … | |
Re: another alternative which I personally feels is better than Dev-C++ is CodeBlocks. Dev-C++ IDE has not been updated for too long. | |
Re: You can use dynamic memory allocation. Learn that stuff because its good for you. There are two types of dynamic memory allocation. 1. malloc 2. new *pls correct me if I'm wrong | |
Re: For your information, the escape character in C++ is the backslash. Hence, if you want a backslash, you need to add another backslash in front of it. (E.g. \\ will give you a backslash) | |
Re: yeah, I think the only way to check is the value. Since an unsigned 8 bits integer (or unsigned char) can only store (0 to 255). The best way is to check whether the value is between the range. [COLOR="Red"]*make sure the memory for storing input is sufficient. After which … | |
Re: Here's a simple example of OOP in real life (building of a car). Before that, I would like to stress that this example is not complete and only explained at the overview level. Here goes: A car has windows. So, you might want to declare a glass class which is … | |
Re: why not use the C++ STL string? E.g. [code=cpp] #include <iostream> using namespace std; int main() { string fname[100]; for(int i=0; i<100; ++i) { cout << "Enter name: "; cin >> name; } //cout << endl << "You entered: " << name << endl; //system("pause"); return 0; } [/code] | |
Re: array is easy. you declare them statically like, int a[10] for an array to store ten integers. Accessing them are simple: a[0] = the first item a[1] = second item a[9] = the last item [COLOR="Red"]*be careful of the array bounds as you might access item that is out of … | |
Re: if you're gonna pass the address of the variables as stated in line 23: void yrCalc(int totalDays, int& year, int& month, int& day) Your variables should contain also their address in line 16: yrCalc(40000, [COLOR="red"]&year[/COLOR], [COLOR="red"]&month[/COLOR], [COLOR="red"]&day[/COLOR]); | |
greetings, I would like to build a subset from a Hashtable. The subset is a Hashtable too. How could I do it? Is there any API out there? Any advise or guideline are appreciated, thank you! :rolleyes: | |
I have been trying to find out what is the meaning of m_nRetCode (value=1012). I get this exception when my program try to execute insert entry into database. Can anyone pls tell me what is the meaning of the value 1012 which is the value of m_nRetCode? Where can i … | |
Hi all, I'm facing this problem in my running app. It is a real-time app and writes to the database whenever data is received. However, there is rare occasions that causes the ExecuteSQL to fail. However, the failure did not throw any exception, so my CDBException did not detect anything(it … | |
Re: for more info, pls browse: [url]www.cplusplus.com[/url] or msdn.microsoft.com (if you're using VC++) | |
Re: include the header file --> #include <stdlib.h> then add this --> system("pause"); before the return 0; *It causes the program to stop until it detects any keypress... | |
Hello, I'm facing a with a real-time app. This real-time app is reading data from the serial port, then, process it. However, it seems to miss some data when the computer has some other apps running. More data are lost when other app do heavier processing. When i try to … |
The End.