15,300 Posted Topics
Re: What do you consider an old thread? One hour, a day, month, year? Seems to me it would be better just to close them, but that topic has been discussed here before. | |
Re: "aligned" is the key word -- what alignment? Not all compilers use the same alignment factor, and some compilers have options to change the alignment. Microsoft compilers have a #pack paragma what lets you align different parts of the program with different alignment factors. | |
Re: You posted the assignment, now tell us what question you have ??? >>int fnGenerateTelNumber(char cTelephone_Num) That only declares a single character, not an array of characters. You have to declare it like this: [icode]int fnGenerateTelNumber(char cTelephone_Num[])[/icode] or any of its other variants: int fnGenerateTelNumber(char* cTelephone_Num) int fnGenerateTelNumber(char cTelephone_Num[7]) When you … | |
Re: The problem is that the array is local to each function. The array in the input() function is destroyed as soon as input() exits. And the array in the display() function contains just random values because it is not the same array as that declared in the input() function. What … | |
Re: >>i get floating point error:abnormal termination in my console screen Must be some other problem in your program because the code you posted should not give you that error. Post the entire program so that we can see what you did. | |
Re: Most companies require an [URL="http://www.irs.gov/businesses/small/article/0,,id=98350,00.html"]Employer ID Number[/URL] mainly for tax purposes. States and local governments also have uses for that number. | |
Re: you can not test for EOF when working with binary files because that may be a valid character in the file. What I would do is read/write with blocks of data, using fread() and fwrite() [code] unsigned char buf[255]; size_t size; while( (size = fread(buf, 1, sizeof(buf), fp) ) > … | |
Re: It was designed that way -- cin is a carry-over from C's getchar() and related functions, which behave the same way. There are no standard functions in either C or C++ that return to the program immediately when a key is pressed. If you want that behavior then you have … | |
Re: "hard" is a relative term -- if you're a snot nosed brat who'se mommy always did things for you, then yes c++ might be hard to learn. Learning something takes more time for some people than for others, but stick to it an it will sink into your brain. | |
Re: 1) functions have to be declared before they can be called. You need to add function prototypes before the main() function. For example: [icode]void readTemp(int kelvinNumber);[/icode] now do the same thing with all the other functions. 2) There is no reason for main() to delare the two variables on lines … | |
Re: For MS-Windows GUI then [url]www.codeproject.com[/url] is a wealth of free code, libraries, DLLs and tutorials. Probably the largest repositories of code on the net. | |
Re: There are several tutorials out there. Just google for "masm tutorials". | |
Re: You have to enter a character 'A', 'B', or 'C'. To convert that into a numerical integer 0, 1, or 2 you just have to subtract 65 because the decimal value of the characr 'A' is 65. Look up [URL="http://www.asciitable.com/"]google for "ascii chart" [/URL]and you will see the decimal values … | |
Re: There is an old saying -- "garbage in, garbage out". What you posted is not even C code. I don't know what it is, but he certainly isn't C or C++ languages. | |
Re: If it works on a PC in US and Canada, why wouldn't it work on a PC in UK? | |
Re: 5.2: Every c++ statement ends with a semicolon. Commas are only used to separate multiple statement on a line. For example: [code] int a; int b; a = 0; b = 1; [/code] The above could also be written like below. Which one to use is up to you -- … | |
Re: scanf() expects the argument to be a pointer, and you passed just a float. Add the & to make num1 a pointer, like this: [icode]scanf("%f", &num1);[/icode] | |
Re: #1: The use of variable i is not the problem. The problem is that you failed to use { and } to surround multi-line if statement [code] for (int i = 0; i < gameLibrary.size(); ++i) { counter = i; cout << counter << "-"; cout << gameLibrary[i] << endl; … | |
Re: >>And the code was working as expected. This is very funny. I am not how the hell this was working. What compiler are you using? Most recent compilers will produce either an error or a warning because of that omission. If you ignored that warning, then shame on you ;) | |
Re: My guess is that the difference is due to running the program on a multi-threaded operating system such as *nix and MS-Windows. The operating system is doing a lot more things than just running your program. | |
Re: 1. The parantheses means type casting -- converting one type of pointer into another. You will see that syntax quite often in C programs. One way to easily find out how things work or don't work is to try it in a very small program. If you omit the parentheses … | |
Re: runtime error: an error that occurs then your program is run such as division by 0, buffer overruns and corrupt stack. There are an infinite (or nearly infinite) number of these errors so its not possible to list them all. compile time error: errors that your compiler produces when it … | |
Re: I guess you expect everyone to be mind readers. You will have to post your code | |
Re: @yatender123: Its not likely you will get anyone to do that for free. Post in Paid Job Offers forum and offer some reasonable $$$ (money) | |
Re: What operating system? fork() is not supported on MS-Windows and your school computer is probably running *nix. | |
Re: To change the time on your computer is operating system dependent. If you have a modern computer then you will have to use a modern compiler so that it can access os api functions. On MS-Windows you will use [URL="http://msdn.microsoft.com/en-us/library/ms724942(VS.85).aspx"]SetSystemTimer()[/URL] As for the batch files, call system() function. | |
Re: Use your compiler's debugger and step through the program to see what it is or is not doing. Then tell us what function(s) has the problem. I, for one, am not about to read all that code and debug it for you. | |
Re: >>Does this mean that int and char are not objects? Yes -- they are not objects. They are data types. A string is not an object either. It is a c++ class that is defined in <string> header file. Objects are an intstance of a data type or c++ class … | |
Re: Keep the blacklist in a vector of strings, then use a loop to compare the name entered by the user to each of the names in the blacklist. [icode]vector<string> blacklist;[/icode] If you want to ignore case, then convert all names to either upper or lower case, whichever you want, so … | |
Re: I think you should be counting the number of paragraphs and the number of lines in each paragraph at the same time so that the program only reads the file one time. Just increment a line counter each time getline() is called. Use a structure to hold both the pragraph … | |
Re: Yes, call opendir() the readdir(). A complete workable example program is in the [URL="http://www.daniweb.com/code/coder46588.html"]Code Snippets[/URL] >>i am using just a few functions of c++ That makes it a c++ program, not a c program. | |
Re: >>Does it matter which one? No. You can use either, but integers are most common. If you use char then the compiler will have to take the time to promote it to an integer before its used as the index into the array. So you can speed up a program … | |
Re: The compiler doesn't really put all the memory for objects in uninitialized global variable data space, only enough of the memory so tht the linker can resolve all addresses. The memory for them is allocated then the program is loaded into RAM. The compiler can't do that if you initialize … | |
Re: Actually not. I installed Ubantu and I had to install g++ separately. So I suppose some distributions may install g++ by default while otheres do not. | |
Re: post code, I can't see your monitor from where I am setting. | |
Re: They are identicdal in terms of speed and memory consumption. You can always substitute a while loop for a [b]for[/b] loop, but not the other way around. The for loop is preferable when you know exactly how many loop iterations there will be. The while loop may be necessary when … | |
Re: schools should get their accrediations yanked and teachers fired for teaching such ancient compilers. There are much better free compilers such as Dev-C++. I'll bet MIT doesn't teach astrologers how to compute the distance of a star with a slide ruler and I know for a fact that NASA doesn't … | |
Re: You need to read a tutorial about win32 api programming. [URL="http://winprog.org/tutorial/"]Here [/URL]is a very popular one. Do all the exercises in that tutorial and then you will understand the code you posted. | |
Re: make sure you include stdio.h and that you add main() function. The code in your link is not a complete program. | |
Re: You need to start learning ODBC in C from a tutorial. Lots of them on the net, including [URL="http://www.easysoft.com/developer/languages/c/odbc_tutorial.html"]this one[/URL]. Its a lot more difficult than what you knew in VB, so be patient and study the tutorial. There are a few c++ wrapper classes to make it a little … | |
Re: You can not use printf() in a MS-Windows gui program. Why? because there is no console. >>have tried passing the name of the array to the function but I looked around and found youd could pass only string to the function MessageBox parameters are character arrays, not c++ strings. There … | |
Re: Post your teacher's email address and the course number of the class you are taking so that we can e-mail the program to him/her. | |
Re: >>I've been addicted to postahol for going on 15 days now with no end in sight Yooo. I've been addicted to DaniWeb for over five years now. And my post count shows that I too am a postaholic. AFAIK there is no cure for it except for death. | |
Re: One way would be to make an array of valid strings then loop through that array [code] string valid[] = {"abc111","abc112","abc1113", ... }; bool ok = false; for(int i = 0; i < sizeof(valid)/sizeof(valid[0]); i++) { if( userdata == valid[i]) { ok = true; break; } } if( ok == … | |
Re: 6 hours? OMG next time use google! [URL="http://msdn.microsoft.com/en-us/library/ms235631(VS.80).aspx"]Here [/URL]is how to do it. [code] wchar_t wname[255]; std::string name = "John"; size_t convertedChars = 0; mbstowcs_s(&convertedChars, wname, sizeof(wname)/sizeof(wname[0]), name.c_str(), _TRUNCATE); IGUIEditBox* player = env->addEditBox(wname, rect<s32>(170, 80, 320, 100)); [/code] | |
Re: [URL="http://www.usenix.org/publications/library/proceedings/als00/2000papers/papers/full_papers/sears/sears_html/"]Here [/URL]is an article about it | |
Re: [QUOTE]Signature spam... Still waiting for them new rules ;)[/QUOTE] Don't hold your breath while waiting for that :) |
The End.