5,676 Posted Topics
Re: [QUOTE=XCal1ber;517393]It worked, thanks! Now, what did you mean in your first post? > The code you posted has a major flaw though. You don't want to check the entire size of the buffer szword but only the number of characters the player typed. In C that would be strlen(szword). oh, … | |
Re: [QUOTE=jmvr_danga_14;512044]i have another problem...! do you know about a star algorithm? our professor required us to put this kind of algorithm to our program..so does any one know what's this algorithm and how it works? also how will i incorporate this algorithm to our program..tnx...[/QUOTE] If he requires it, he … | |
Re: [QUOTE=chihuyu;510746]Hello,I am new for C++.The following are the codes I wrote to calculate the sum of 2^n. The result is 2046 after running the program.That is correct. But when I change the condition to n<=100,the result comes with -2,which is obviously wrong.Then I tried different n and found if n<=30,the … | |
Re: [QUOTE=k2k;511891]the array size, i, is supposed to be 271.. i set x = i-1 //270, the last index for cout...... and then i-- ,,,, up to 0....... i don't know why it doesn't read or display from the beginning of the txt file eventhough if i test with a code … | |
Re: [QUOTE=wollacott;511801]but will my code work if i enter one single digit?[/QUOTE] What happened when you tried it? You are basically asking us to write your program for you. | |
Re: [quote=Grunt;248894]Even I am not sure what he meant but I didn't ask because that would have spoiled his fun :D[/quote] See Wolfpack's signature... | |
Re: Where is [I]your[/I] attempt at it? You should know by now we won't do the work for you. | |
Re: And in simpler terms... 1D array: The list of TARGET stores in one city. -- Store numbers 1,3,5,7,9 in Detroit 2D array: The list of Target stores in each state by city. -- in Michigan: ---- 1D array for Detroit ---- 1D array for Pontiac ---- 1D array for Lansing … | |
Re: [QUOTE=anallan;505640]here's the code that i've done but it doesn't work correctly..can someone help me out?[/QUOTE] First off, please be a little clearer. [I]Explain[/I], don't just say it doesn't work. [I]Why[/I] doesn't it work? What [I]does[/I] it do? What I'd do is immediately after the FOR, start the WHILE (or preferably … | |
Re: You need to know what the format of the data file is ([I].dat[/I] is for data file, I assume saying it's a program is just to throw us off ;)) IOW, you need to know how each byte is defined, whether it's a byte, word, long, character, float, etc, in … | |
Re: [QUOTE=vishesh;508377]Use you command promt and run. Or if you want to run it directly add [icode]std::cin.get()[/icode] at the end of main() to wait for [B]a keystroke[/B]. However this wont work under certain circumstances as mentioned [URL="http://www.daniweb.com/forums/thread90228.html"]here[/URL].[/QUOTE]Actually, wait for [I]an ENTER[/I] :icon_wink: [QUOTE=Salem;508389]Was that first post meant to be a [URL="http://en.wikipedia.org/wiki/Haiku"]Haiku[/URL] … | |
Re: [QUOTE=savio_1987;508556]i saw the libary there are a few commands like biascom in bios.h, i feel that will do the job of getting the values from the serial port. but how do i transfer it on to a test file??[/QUOTE] First things first. Read data from the serial port. Don't try … | |
Re: Look up the function [url=http://www.cplusplus.com/reference/clibrary/ctime/][I]time()[/I][/url] and it's friends. | |
Re: Of course there's output. You have [I]cout[/I] statements in your code. Unless you're not telling us the whole story. Explain [I][B]exactly[/B][/I] what is happening, and [I]why[/I] it's wrong. Examples are easier for us to understand. And about "[B]I WANT IT FOR TOMORROW[/B]" -- we don't care. You should have posted … | |
Re: To explain what [B]Wee[/B] is telling you... [QUOTE=iamthwee;507364]Loose the '' around the numbers. i.e '2' becomes just 2[/quote] You don't need to loosen anything, you need to [I]lose[/I] something... :icon_rolleyes: '2' is the ASCII character, 2 is the number. You need to compare the number 2, not the character. Same … | |
Re: My hint #1: Use a [url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies#faq_keep_it_organized]better title[/url]. Something like [I]Creating a Date Histogram[/I]. Also, [url=http://www.daniweb.com/techtalkforums/thread78223.html]Read This[/url] | |
Re: 121 posts and you still can't make a proper title? And you should know by now most of us won't help without posting code, nor will we download it. | |
Re: Problem #1: Your title. [url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies#faq_keep_it_organized]See this[/url] [QUOTE=sana_akram;505990]can we send the input from command prompt screen ...[/quote] Problem #2: A command prompt [I]screen[/I] does not contain input. A screen is an [I]output[/I] device. [QUOTE=sana_akram;505990]....to the text file in C++ [/QUOTE] Problem #3: C++ does not contain a text file. C++ can … | |
Re: Examples [code] 1100100101001001 11111111 ---------------------- 00000000[B]01001001[/B] buff gets 01001001 1101110110110011 11111111 ---------------------- 00000000[B]10110011[/B] buff gets 10110011 [/code] | |
Re: [QUOTE=rajatC;505773]i also used it in assembly language the code was 0dh,0ah...someone asked me what does each byte mean? please explain!![/quote] 0Dh is carriage return. Return to the beginning of current line. 0Ah is a line feed. Drop down to the next line. In assembly you don't have the luxury of … | |
Re: I would let the OP post [I]his[/I] code before writing it for him... | |
Re: You didn't look hard enough. Didn't you run across the [icode]getline()[/icode] method? | |
Re: Hmmm, badly formatted code. Anytime we see [code] } } } [/code] we know we're not going to be able to follow the code easily. [url=http://www.gidnetwork.com/b-38.html]See this[/url] and format your code properly. And please don't post code without some kind of explanation. New people can't necessarily understand uncommented code without … | |
Re: [QUOTE=rajatC;500081]write a function for factorial and sum its digits and check for equality...it's simple..isn't it??? do u want a complete code?? if yes then sorry..nobody will help you here for that...[/QUOTE] Good point. [QUOTE=rajatC;500114] ... this function returns [B]sum of the factorials of all the digits[/B] of a given numbers … | |
Re: [QUOTE=iamthwee;496431][aside] I'm mighty popular all of a sudden, that's really flattering[/aside][/QUOTE] Yeah, but it's generally not the type of popularity that's healthy... [QUOTE=iamthwee;497053]Those type of comments are written in such poor taste. Something should really be done about that, as I'm sure if that were an actual post, a warning … | |
Re: [QUOTE=sa-al;500103]hello i have changed my previous code about converting a statement to reverse polish notation but still i think it has serious problems .can any one help me solve it? i have just a little time![/QUOTE] You [I]think[/I] you have a problem? What makes you think so? Have you read … | |
Re: [QUOTE=silent_letter;500513]I am a new learner of C and I tried to write a program about searching a keywrod from a .txt file and counting the number of time that the keyword repeats My program is below...it can't work...and I can't understand why.... can someone please help me...T_T Thank you [/QUOTE] … | |
Re: [QUOTE=zeroground;498838]i want c++ ...can u write the code please ...i need it urgent[/QUOTE] Did you fix the errors? When you do, repost and ask questions. Do NOT ask us to do your work for you. And stop using QUOTE tags when you need CODE tags. | |
Re: And stop making multiple threads on the same stupid with the same stupid title. Please read the RULES. | |
Re: You have to format the stamp yourself from the information received from the functions [B]Ancient Dragon[/B] suggested you look into. | |
Re: [QUOTE=AbberLine;495952][code] do { if(getch()){ switch (getch()){ case UP: hook_up(); break; [/code] but it dosn't do thins the way i would like them to be done. Again I translated some variable or function names. What happens now is that I need to press a movement key twice to get it happen. … | |
Re: Line 60 is wrong in your code, and lines 88-92 are close.... | |
Re: Your problem seems to be trying to get your input commands to do the processing for you. That's difficult at best. Just read in the entire line as suggested and look at the line character by character. That is basically all [icode]cin.get()[/icode] does anyway. | |
Re: [QUOTE=jobs;496228]When you read file in C and move to next line and so on. This seems you have to access file top to bottom sequentially without skipping lines. I need a way to read very 5th line or something similar to it. I am just concerned with data that is … | |
Re: Do the program in small steps: 1) Start by reading each question and all the answers into 6 strings. Continue until all questions read. 2) Next step, read as above and write all but your answer to the new file. 3) Third step, after reading, look at your answer and … | |
Re: [QUOTE=rajatC;492233]long int??? for what??? sorry i didnt get ur point.. i m using double to store the number of total permutation and an integer array[n] to store different permutations of n numbers...[/quote] [I]Double[/I]s are inexact. You can't have 2354.34 permutations. Therefore [I]double [/I]is a bad choice. [QUOTE=rajatC;492233]And [B]how will long … | |
Re: [QUOTE=Jishnu;495194]This happens because new posters like Knightzs are not fully aware of the rules over here. [/QUOTE] And why is that? Aren't the rules clear? :icon_wink: | |
Re: [QUOTE=evilseed187;493473]I need help with beginning code to simple game of hangman in C++ Don't know where to start and it is due in six hours.[/QUOTE] Start with ignoring the code [B]jaepi[/B] pointed to. It doesn't work, and it's not that great. Did you miss reading the post titled [url=http://www.daniweb.com/techtalkforums/thread78223.html][b]Read Me:[/b] … | |
Re: It would make more sense to use HEX values rather than DECIMAL. 223 is relatively meaningless, but 0xDF makes sense since each character is immediately translatable into binary: D = 1101 F = 1111 223 would be considered a 'magic number' and should be avoided. | |
Re: You are attempting to read a single character, right? When you enter that character, what key(s) to you type? The character and ENTER, right? Well, the ENTER is also put into the input buffer, but when you read a single character, only the first character was removed from the buffer. … | |
Re: In strings, the \ character is the first character of a pair, like \n, \t, etc. If you want a \ in a string you need to use \\. | |
Re: [QUOTE=mjoshi;493267]I tried the following way and it doesnt work:[/quote] [code] if (cbuff[0] == '#' && cbuff[2] == 'N' && cbuff[3] == 'a' && cbuff[4] == 'm' && cbuff[5] == 'e')[/code] Instead, how about [code]if (strncmp(cbuff, "# Name", 6)[/code] Next: [code] strncpy (name, cbuff+8, 6); name[6] = '\0'; strcpy(filename, name); strcat(filename,"_TAUTOMER_"); … | |
Re: You should scrap this code completely. You need to look into the values of characters. For example, the letter 'A' is the same as the integer value 65. Run this program and see the correlation between characters and numbers. Then think about your idea with [I]this[/I] information in mind. [code=cpp] … | |
Re: [QUOTE=Srynx;462728]Hi, I've wrote all code using using matrices and the problem happens even more often.[/QUOTE] So rather than fix it, you took out what you were supposed to learn? [QUOTE=Srynx;462728]I've tried it in another compiler (DEV-C++) and with this one program just doesn't run.[/QUOTE] That should tell you something. The … | |
Re: The array being filled with the order could simply contain the item numbers being ordered, one element per ordered item. Example, if the array contained 1,1,2,1,3,3, then 3 dogs, 1 fry, and 2 lemonades were ordered. Then at end of order, use each element of the array as an index … | |
Re: Do you really want your operating system to do the logging? Or do you only need a file created with log entries in it? | |
Re: [QUOTE=nicz888;492476]:)[/QUOTE] What was that post? A bump? Never bump your messages. Someone will get to you when they log in. [code=c++] string == strcat(string," "); string == strcat(string,temp); [/code] What do you think these lines are doing? I'll bet it's not what you expect.... [QUOTE=nicz888;492476]$ is a weird character that … | |
Re: [QUOTE=manster;492628]I'm clueless as to how to fix the errors in this contact information manager program. please help. Thanks in advanced[/QUOTE] You're welcome in advance. Out of 290 lines you aren't really asking us to guess what lines have errors and what the errors are, are you? Details, please... |
The End.