15,300 Posted Topics
Re: If user enters wrong data then display an appropriate error message then re-display the original question. Best way to do that is to put all that in a loop and break out of the loop only when user enters correct data. | |
Re: Send me a copy of the program and I'll test it on my computer. Might be a problem with the pc you're trying to use. | |
Re: You can't use cin >> for strings that may contain spaces because cin will stop at the first white space (spaces and tabs) character. If you want white space in the string then use getline() | |
Re: google for "berkley socket tutorial" or "posix socket tutorial" | |
Re: class constructors are private, so you will not be able to use that class for anything. The second constructor is setting a pointer to some other object -- a very very bad idea because when the other object is destroyed the pointer in MyClass will become invalid. You need to … | |
Re: There are lots of sort algorithms -- google for "bubble sort", which is the easiest one to write. Or you could use cl++ std::sort function. [code] #include <string> #include <algorithm> int main() { std::string s = "acefd"; std::sort(s.begin(),s.end()); ] [/code] | |
Re: += is ok there because he's using std::string Your program probably needs to check for sql errors on return because it could be some other problem, such as not logged into mysql. | |
Re: What operating system and compiler? What GUI platform (e.g. win32 api, MFC, Windows Forms, wxWindows, etc) | |
Re: The timer is set to run for about 90 secndxs. Why do you think it should run until 1:30 ? >>if(seconds == 90) Impossible. The loop will stop as soon as seconds == 90, so the statement above will never get executed. | |
Re: >>I'm trying to display the contents of a matrix without using "cout" in my class Huh?? How do you plan to display something without using either cout or printf()? one way to accomplish that in MS-Windows is to call [URL="http://msdn.microsoft.com/en-us/library/windows/desktop/aa365747(v=vs.85).aspx"]WriteFile[/URL]() instead of cout. | |
Re: You need to first get the current date from the computer's clock. Use the functions in time.h, time() returns the date/time in seconds, then call localtime() to covert that into a struct tm. Next convert user's birth date into month, day and year integers, then just subtract from struct tm. … | |
Re: or [code] while( in_stream >> name >> combo >> op1 >> op2 >> op3 >> op4) { // do something with the data } [/code] | |
Re: Visual Studio most certainly does contain a c++ compiler. You can get vc++ 2010 Express for free, as well as vb.net and C#. It's the best compiler suite there is for .net framework, afterall it is produced by the same company that wrote .net -- Microsoft. You can't get a … | |
Re: why not just make the array of pointers (note that arrays of references are illegal). [code] ReceiptBag zero("zero"); ReceiptBag one("one"); ReceiptBag * bags[] = {&zero, &one}; [/code] | |
Re: If you surround the name of the include file with quotes the compiler will expect to find it in the current working directory (where the .c or *.cpp files are found). >>libCNum.a VC++ 2010 may not recognize that file format. They usually have *.lib extension. | |
Re: Do you want to know how to write a 1d matrix out to that file or read the file into the 1d matrix? | |
Re: It's not all that difficult to do. Here's an example of push_back [code] const int BlockSize = 10; // allocate this number of elements at one time int MaxArraySize = 0; // initial size of the array int CurrentSize = 0; // current number of elements used in the array … | |
Re: Don't worry -- what you are experiencing is a common problem; forgetting. Keep on practicing as often as you can and you will eventually be able to remember it. Its very similar to learning to play a musical instrument; it takes lots and lots of practice. If you forget what … | |
Re: use wcout [code] #include <iostream> using namespace std; int main() { wchar_t buf[] = L"Hello World"; wcout << buf << L"\n"; } [/code] | |
Re: We have fee wifi in a lot of places arond here -- gas stations, hospitals, McDonalds, and other businesses. These places even have signs on their buildings -- "Free Wifi". I agree with Grumpy, the judge should dismiss the case because free wifi has nothing to do with piracy. That's … | |
Re: Its not "a company" but many companies/volunteer programmers with many different distributions of the operating system. One way they make money is on programming support. | |
Re: No. The type between < and > in vector must be a data type, not the name of a variable. vowels is not a datatype. | |
Re: Compile for debug mode then single step through the program so that you can see where the problem is. How to do that will depend on the compiler you are using. >>vector<int>* readDice(vector<string>& anImage) { That function is attempting to return a pointer to local variable. And, like all local … | |
Re: zip up all files and attach so that we can see what you did | |
Re: There are none for him at this time. Tell him to wait a few more years to grow up a little and finish grade school. There are a lot of necessary things he probably doesn't know yet, such as a good foundation in algebra. In the meantime he should be … | |
Re: do you know how to write a for loop? If not, then [URL="http://www.cplusplus.com/doc/tutorial/control/"]here is a tutorial[/URL] | |
Re: >>is there a way i can implement my insert function so that everytime it inserts a number it inserts it on the correct place Of course there is. Just start at the beginning of the list and check each node for a value that is either < or > the … | |
Re: LPCWSTR is a pointer to TCHAR so just use the & address operator to make the conversion `TextOut (hdc, 40,40,&chCharCode, 1);` | |
Re: I'm exclusively Windows 7 and use either Code::Blocks or VC++ 2010 Express. Of course I don't do professional coding any more so I am free to use whatever I want instead of what some employer forces down my throat. | |
Re: Size is read-only meaning you can't change its value. | |
Re: To append data to the existing file you have to add another parameter to the open() statement [icode]myfile.open ("Sold Tickets.txt",ios::app);[/icode] See the options in [URL="http://www.cplusplus.com/reference/iostream/fstream/open/"]this link[/URL] | |
Re: Are you allowed to use standard C functions? sprintf() can do all that for you, just a matter of giving it the correct forma spcification. E.g. "%x" converts to hex and "%f" to float | |
Re: The first function is incorrect [code] void print (string word) { cout << word << '\n'; // display the string } [/code] Now do similar for second function, but this time put cout statement inside a loop. | |
Re: If you are wanting to learn win32 api, then [URL="http://winprog.org/tutorial/"]this[/URL] is a good introduction. But it is far easier to use a different language, such as C# or CLI/C++ (Windows Forms) | |
Re: Why do you think CB doesn't support DirectX? or graphics? Have you read any of [URL="http://www.google.com/#sclient=psy-ab&hl=en&source=hp&q=directx+tutorial+c%2B%2B&pbx=1&oq=direcgtx+tuto&aq=1l&aqi=g-l4&aql=&gs_sm=1&gs_upl=7245l8566l1l11395l2l0l2l0l0l0l0l0ll2l0&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=c3fe1decc135fe9e&biw=1647&bih=909"]these[/URL] tutorials? | |
Re: Up or down voting a post anonymously doesn't affect the person's rep points. All it does is show whether or not you liked the post, nothing more. That is not the same as the question you posed in the poll. | |
Re: NULL is defined differently in c++ -- its defined as 0, while in C its defined as (void*)0. '\0' is the same as 0. I never use NULL for anything other than initializing pointers. | |
Re: You need to use an array of ints, one for each task. Or if you know there will be only 4 tasks then you can use 4 different int counters [code] int count1 = 0, count2 = 0, count3= 0; int main(){ int option =0; bool exit = false; while(!exit) … | |
Re: It might simplify the program if you write two more functions: 1) a function that inserts a new node into the list in its correct position, and 2) a function that displays all the nodes in the list. Then main() can contain a simple loop [code] void InsertNode(node**head, node*p) { … | |
Re: Did you find [URL="http://www.zigbee.org/en/spec_download/zigbee_downloads.asp"]this[/URL] ? | |
Re: >>why it is assigned i=1 That's called initializing a variable to some known value. The value 1 was arbitrary, would have been any number. The important point is that the value is something that the author knows. Programmers would normally initialize variables to 0. >>why it has given i<=10 So … | |
Re: Learn socket programming. How to do that will depend on the operating system you are using. If *nix you need [URL="http://www.linuxhowtos.org/C_C++/socket.htm"]POSIX sockets[/URL]. MS-Windows use [URL="http://johnnie.jerrata.com/winsocktutorial/"]WinSocket[/URL]. | |
Re: Your compiler does not support threads. You will have to use a modern compiler such as Code::Blocks or VC++ 2008 Express, both are free for the downloading. | |
Re: [URL="http://www.daniweb.com/software-development/cpp/threads/6542"]Here[/URL] is a short tutorial | |
Re: >>It seems like Visual Studio 2010 compiler is complaining that despite all classes are in the same namespace, the abstract class's pure abstract method is not implemented. I think you mis-interpreted the error message -- see comment below. This works ok for me using vc++ 2010 express. The only change … | |
Re: [QUOTE=jatinkhandelwal;1751825]i want something like this i want to search a file for various data types and print the sizes of them acordingly[/QUOTE] Post some examples of what will be in the file so that we don't have go guess that you want. | |
Re: How to do that all depends on the compiler and/or IDE you are using. Basically, a library is nothing more than a collection of compiled functions that are in a file with *.lib or *.a file name. *nix computers also have something called shared libraries, which has a *.so file … | |
Re: The only way to find out how many times you executed the program is to write a value to a file or the registry. Programs can not retain values from one instance to another. | |
Re: >>There are some certifications that are nice to have and others that are simply "must haves" in today's competitive job market. Certifications only help you get a job. Two people with identical education and experience, the one with certs will probably get hired. None of the are needed for entry … |
The End.